Separator
Styled divider with horizontal/vertical orientation.
Installation
Add this component to your project:
pnpm dlx shadcn@latest add @foldcn/separatorSource
The component ships as plain source — no build step, no wrapper. Copy it and make it yours.
registry/default/ui/separator.ts30 linesimport type { Html, HtmlBuilder } from 'foldkit/html'
import { cn } from '@/lib/utils'
export type SeparatorOrientation = 'horizontal' | 'vertical'
export const separatorClass =
'shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch'
type SeparatorConfig = Readonly<{
orientation?: SeparatorOrientation
className?: string
}>
/** Styled separator — a `role="separator"` divider. */
export const separator = <M>(config: SeparatorConfig, h: HtmlBuilder<M>): Html => {
const orientation = config.orientation ?? 'horizontal'
return h.div(
[
h.Class(cn(separatorClass, config.className)),
h.Role('separator'),
h.AriaOrientation(orientation),
h.DataAttribute('slot', 'separator'),
h.DataAttribute('orientation', orientation),
h.DataAttribute(orientation, ''),
],
[],
)
}