icon

Morainev0.5.0

Separator
elementsseparator

Separator

Visual divider with configurable orientation, style, and optional label content.

Import#

import { Separator } from 'moraine'

Slot Structure#

Horizontal or vertical rule with an optional content label in the center.

Without content#

root
└── border

With content#

root
├── border
├── container
└── border

Examples#

Sizes#

Border thickness variants.

function Sizes() {
const SIZES = ['xs', 'sm', 'md', 'lg', 'xl'] as const
return (
<div class="w-xl space-y-4">
<For each={SIZES}>
{(size) => (
<div class="space-y-2">
<p class="text-xs text-muted-foreground tracking-wider uppercase">{size}</p>
<Separator size={size} />
</div>
)}
</For>
</div>
)
}

Types#

Solid, dashed, and dotted divider styles.

function Types() {
const TYPES = ['solid', 'dashed', 'dotted'] as const
return (
<div class="w-xl space-y-4">
<For each={TYPES}>
{(type) => (
<div class="space-y-2">
<p class="text-xs text-muted-foreground tracking-wider uppercase">{type}</p>
<Separator type={type} />
</div>
)}
</For>
</div>
)
}

With Content + Vertical#

Inline content and vertical separators in flexible layouts.

function WithContentVertical() {
return (
<div class="space-y-6">
<Separator>
<span class="text-xs text-muted-foreground">OR</span>
</Separator>
<div class="flex gap-4 h-20 items-center">
<span>Left</span>
<Separator orientation="vertical" />
<span>Center</span>
<Separator orientation="vertical" type="dashed" class="text-primary" />
<span>Right</span>
</div>
</div>
)
}

API Reference#

Attributes#

Slotroot4 attributes
Separator line container, including optional label content.

Data Attributes

1
Data AttributeDescription
data-orientation
Stores the rendered orientation.

ARIA Attributes

3
ARIA AttributeDescription
aria-hidden
Hides decorative content from assistive technology.
aria-orientation
Communicates horizontal or vertical orientation.
role
Defines the semantic role exposed to assistive technology.

Props#

PropTypeDefaultDescription
childrenJSX.Element
Additional content to render inside the separator (usually between two borders).
classClassValue
Class applied to the component root or trigger element.
classesSeparatorT.Classes | undefined
decorativeboolean | undefinedfalse
Whether the separator is decorative (hidden from assistive technologies).
orientation"horizontal" | "vertical" | undefinedhorizontal
The orientation of the separator.
refJSX.HTMLElementTags["div"] extends { ref?: infer Ref; } ? Ref : never | undefined
size"xs" | "sm" | "md" | "lg" | "xl" | undefined
styleJSX.CSSProperties | undefined
stylesSeparatorT.Styles | undefined
type"solid" | "dashed" | "dotted" | undefined