Replies: 1 comment 2 replies
-
It sounds like you are asking for Radix Themes to come with a styling solution. Unlike MUI or Chakra, Radix Themes doesn’t come with any opinionated styling solution itself. You can use whatever styling tech that works for you. Because of that, there’s no ”non-Radix” way to use the CSS tokens that we provide. Any way to use the CSS tokens that Radix Themes provides is legit. Let’s take your example:
Nothing wrong with using Tailwind, CSS Modules, CSS-in-JS, or a straight
Yep, that’s by design, you probably want something like this: <Flex display={{ md: 'none' }}>
<IconButton>
<HamburgerMenuIcon />
</IconButton>
</Flex> Using only layout components for layout is a bit more verbose, but off-loading layout responsibilities to them makes the UI code easier to read and to maintain in the long run. If this approach is not what you expected and/or is new to you, I’d suggest just to trust it and go along with it for a bit—it “clicks” with most people at some point. I can’t recommend it enough over having a soup of props that control both presentation, functionality, and layout on your buttons, badges, inputs, and so on. Aside from margin props on each component, we don’t plan to introduce other layout props on non-layout components. Also, don’t |
Beta Was this translation helpful? Give feedback.
-
I get the idea of the component library trying to encapsulate the low-level API as much as possible, but I believe it should also leave room for the user to do "low-level stuff" (not to mention it's not THAT low-level).
Currently, I notice two issues when trying out the library.
shadow
,border
.display
.The two combined make things quite inconvenient if I wish to stick to the "Radix Theme" way of making use of design tokens.
Example use case: create a
Header
component that contains a hamburger button that only shows up inxs
breakpoint or below.Header
, a very common design, there is no native way of specifying shadow or border, and I have to resort to using Tailwind class, CSS Module, or other non-Radix ways to achieve that. The ideal case would be the components to have ashadow = "1" | "2" | "3" | "4"
prop for example.display
value. Yet, thedisplay
prop is only available in layout components, but notIconButton
. So yet again, such common design needs the help of 3rd party tools to achieve. Or I have to add a<Box asChild>
wrapper, which doesn't make too much sense to me in this case.Benchmarks
sx
prop for all components, to allow applying one-off styles. It works similar to the nativestyle
prop but allows the user to specify attributes likemt
to make use the design token.style
propsx
prop, but common style props, likedisplay
,m
, etc. are available to all components.Beta Was this translation helpful? Give feedback.
All reactions