You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Separator: cn-separator* preset classes are dead in all eight styles
#2776
While building on the cn-* style system I noticed the base Separator is the one component that does not use its preset hook. separator.svelte sizes itself with inline utilities (bg-border shrink-0 data-[orientation=horizontal]:h-px ...), and the cn-separator, cn-separator-horizontal, and cn-separator-vertical classes that all eight presets define are never emitted. They are dead in every theme. For contrast, field-separator styles itself through cn-field-separator.
It is also a quiet footgun for anyone extending the system. The natural way to route the separator through its hook, the same as every other component, is data-[orientation=horizontal]:cn-separator-horizontal. That compiles to nothing: a Tailwind v4 variant only attaches to a registered utility, not a plain class, so the divider collapses to 0px standalone, or to a thick bar inside the absolutely positioned field-separator wrapper.
@import"tailwindcss";.cn-separator-horizontal{@apply h-px w-full;}@source inline("data-[orientation=horizontal]:cn-separator-horizontal");/* compiled output contains no rule for the variant */
Two ways to resolve:
Delete the unused cn-separator* classes from the eight presets.
Wire the separator into the cn-* system: the component emits only cn-separator, and each preset sizes via the data-orientation attribute bits-ui already sets:
Rendering is unchanged; the dead classes become the live styling.
I lean toward option 2 for consistency, but separator.svelte carries a comment ("this is different in shadcn/ui but self-stretch breaks things for us"), so I wanted to check the inline approach was not deliberate before opening a PR. Happy to send either one.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
While building on the cn-* style system I noticed the base Separator is the one component that does not use its preset hook.
separator.sveltesizes itself with inline utilities (bg-border shrink-0 data-[orientation=horizontal]:h-px ...), and thecn-separator,cn-separator-horizontal, andcn-separator-verticalclasses that all eight presets define are never emitted. They are dead in every theme. For contrast,field-separatorstyles itself throughcn-field-separator.It is also a quiet footgun for anyone extending the system. The natural way to route the separator through its hook, the same as every other component, is
data-[orientation=horizontal]:cn-separator-horizontal. That compiles to nothing: a Tailwind v4 variant only attaches to a registered utility, not a plain class, so the divider collapses to 0px standalone, or to a thick bar inside the absolutely positionedfield-separatorwrapper.Two ways to resolve:
Delete the unused
cn-separator*classes from the eight presets.Wire the separator into the cn-* system: the component emits only
cn-separator, and each preset sizes via thedata-orientationattribute bits-ui already sets:Rendering is unchanged; the dead classes become the live styling.
I lean toward option 2 for consistency, but
separator.sveltecarries a comment ("this is different in shadcn/ui but self-stretch breaks things for us"), so I wanted to check the inline approach was not deliberate before opening a PR. Happy to send either one.All reactions