Separator
View in Storybook
Explore interactive examples and all component variations in our Storybook.
The Separator component provides a visual divider to separate content sections. Built on Radix UI, it supports both horizontal and vertical orientations with accessibility features. Perfect for organizing content, creating visual hierarchy, and improving readability in layouts.
Basic Usage
Radix Primitives
An open-source UI component library.
Next.js
The React framework for production.
Vertical Separator
Blog
Docs
Source
Navigation Menu
Card Sections
User Profile Layout
JS
John Smith
Frontend Developer
About
Passionate developer with 5+ years of experience in React and TypeScript.
Skills
ReactTypeScriptNode.js
Sidebar Layout
Main Content
This is the main content area. The vertical separator creates a clear division between the sidebar and the main content.
Custom Styling
Default Separator
Thick Separator
Dashed Separator
Gradient Separator
Vertical Separators with Custom Heights
Item 1Item 2Item 3Item 4
Properties
Separator
| Property | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" | The orientation of the separator. |
decorative | boolean | true | Whether the separator is decorative (not focusable). |
className | string | - | Additional CSS classes for custom styling. |
Accessibility
The Separator component includes comprehensive accessibility features:
- Semantic HTML - Uses proper ARIA separator role
- Screen Reader Support - Properly announced as a separator element
- Decorative by Default - Non-focusable decorative separators by default
- Keyboard Navigation - Can be made focusable when
decorative={false} - Visual Clarity - Clear visual distinction between content sections
Common Use Cases
The Separator component is perfect for:
- Content Organization - Dividing sections in articles, forms, and layouts
- Navigation Menus - Separating navigation items and menu sections
- Card Layouts - Creating sections within cards and panels
- Sidebar Navigation - Organizing navigation groups and categories
- User Profiles - Separating different information sections
- Settings Pages - Dividing configuration groups and options
- Data Lists - Creating visual breaks between list items or groups
Best Practices
- Consistent Spacing - Use consistent margins around separators
- Appropriate Orientation - Use horizontal for content sections, vertical for inline items
- Visual Hierarchy - Use separators to enhance, not overwhelm content structure
- Accessibility - Keep decorative separators non-focusable for better screen reader experience
- Custom Styling - Use className to match your design system colors and thickness
- Semantic Usage - Use separators to logically group related content
- Responsive Design - Consider how separators behave on different screen sizes
- Color Contrast - Ensure separators have appropriate contrast for visibility