-
I've been wondering about dot notation versus named exports? Is there a specific reason Radix adopts dot notation as opposed to named exports for all component parts? Can it impact tree-shaking and any know compatibility issues with NextJS? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Radix Themes exports both the dot notation version and individual parts for every component. Our personal preference when building UIs is to use the dot notation, but Next.js server components don't support that well yet, so we'll have to see how that pans out over time. As for tree-shaking, for multi-part components you usually need all or almost all of the parts anyway. We do have some tree-shaking issues, but that's not related to dot notation and will be fixed soon. Radix Primitives provides each primitive as a separate package, and how your import them defines whether you get dot notation or the individual parts of a primitive. |
Beta Was this translation helpful? Give feedback.
Radix Themes exports both the dot notation version and individual parts for every component. Our personal preference when building UIs is to use the dot notation, but Next.js server components don't support that well yet, so we'll have to see how that pans out over time. As for tree-shaking, for multi-part components you usually need all or almost all of the parts anyway. We do have some tree-shaking issues, but that's not related to dot notation and will be fixed soon.
Radix Primitives provides each primitive as a separate package, and how your import them defines whether you get dot notation or the individual parts of a primitive.