Open History to see the last commit
1import { ark } from '@ark-ui/solid/factory'
2import { splitProps } from 'solid-js'
3import type { HTMLArkProps } from '@ark-ui/solid/factory'
4import { cn } from '@/utils'
5β
6// Ported from the original shadcn/ui + Radix UI + React component.
7// This wraps the Ark UI + SolidJS primitive and preserves shadcn's Tailwind-based
8// design-system API, variants, and styling.
9// https://ui.shadcn.com/
10β
11type SeparatorOrientation = 'horizontal' | 'vertical'
12β
13type SeparatorProps = HTMLArkProps<'div'> & {
14 orientation?: SeparatorOrientation
15 decorative?: boolean
16 'data-slot'?: string
17}
18β
19/**
20 * A horizontal or vertical divider for separating related content.
21 *
22 * @example
23 * ```tsx
24 * <Separator />
25 * ```
26 */
27function Separator(props: SeparatorProps) {
28 const [local, others] = splitProps(props, [
29 'class',
30 'orientation',
31 'decorative',
32 'data-slot',
33 ])
34β
35 const orientation = () => local.orientation ?? 'horizontal'
36 const decorative = () => local.decorative ?? true
37β
38 return (
39 <ark.div
40 {...others}
41 role={decorative() ? 'none' : 'separator'}
42 aria-orientation={decorative() ? undefined : orientation()}
43 data-slot={local['data-slot'] ?? 'separator'}
44 data-orientation={orientation()}
45 class={cn(
46 'shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch',
47 local.class,
48 )}
49 />
50 )
51}
52β
53export { Separator, type SeparatorProps }