Separator
A separator component for visually dividing content sections horizontally or vertically
Installation
Terminal
Import
Component.tsx
Basic
Separator is a visual divider used to separate content sections.
Features:
- Supports horizontal (default) and vertical orientations
- Accessible to screen readers with proper ARIA attributes
- Decorative mode available for purely visual separators
- Minimal styling that integrates with design system
Usage:
- Use between content sections to create visual hierarchy
- Horizontal separators work well between stacked content
- Vertical separators work well between inline or flex items
- Use `decorative` prop when separator is purely visual
Accessibility:
- Uses `role="separator"` for semantic meaning
- Includes `aria-orientation` for screen readers
- Decorative separators use `role="none"` to be ignored by assistive technology
Basic: Default horizontal separator.
The most common use case - a simple horizontal line that divides content vertically.
Content above
Content below
Horizontal
Horizontal: Demonstrates horizontal separator usage in a list context.
Horizontal separators are useful for dividing stacked items like
navigation links, menu items, or content sections.
Vertical
Vertical: Demonstrates vertical separator in a navigation bar.
Vertical separators are ideal for dividing inline content like
navigation links, toolbar buttons, or horizontal lists.
Decorative
Decorative: Separator that is ignored by screen readers.
Use the `decorative` prop when the separator is purely visual and
doesn't convey any semantic meaning to users.
This separator is decorative and will be ignored by screen readers.
Use decorative separators when the visual break doesn't convey semantic meaning.
Custom Styling
CustomStyling: Demonstrates custom styling options.
The separator accepts className for custom styling. You can modify
thickness, color, margins, and other CSS properties.
Default
Custom color
Thicker
Dashed (via gradient)
With margin
With Children
WithChildren: Separator with content in the middle.
Use children to insert content (text, icons) between the separator lines.
Common patterns include "OR" dividers and section labels.
or
Section Title
New
In Card
InCard: Separator used within a card component.
A common pattern is using separators to divide card sections
like header, body, and footer.
Card Title
Card subtitle or description
This is the main content area of the card. It can contain any content you need.
API reference
| SeparatorProps | Type | Default |
|---|---|---|
orientation | undefined |"horizontal" |"vertical" | - |
decorative | boolean |undefined | - |
variant | undefined |"default" |"light" |"dark" |"reset" | - |
ref | ((instance: HTMLDivElement |null) => void) |RefObject<HTMLDivElement> |null |undefined | - |