shadcn.io is not affiliated with official shadcn/ui
Separator examples · Spacing
Inset Separator for React
A horizontal separator inset from both edges with margins and a width override.
Soften a full-bleed line. This React Separator uses mx-8 and resets its width to auto, so the default full width doesn't add to the margins and overflow its parent. Use it for list rows, nested card sections and any break that should line up with padded content.
Preview
Installation
FAQ
When should I use an inset separator?
Inside padded cards, list items and sidebars, where a full-bleed line feels heavier than the content. Full width is better for page-level section breaks.
How much horizontal inset?
Match the container's padding: a card with p-6 takes mx-6, or pad the parent and leave the line at full width. mx-8 is a 32 pixel inset for wider panels.
Why does the width need an override?
The Separator is full width by default. Full width plus mx-8 overflows its parent by 64 pixels, so the example sets the width back to auto and the line fits between the margins.
Use the component's orientation variant, data-horizontal:w-auto, so it replaces the default width.
Should the line align with the text?
Usually. If the content has px-6, inset the line by the same amount so both edges share one vertical axis.
Related
- Tight Spacing SeparatorA horizontal separator in a flex column
- Default Spacing SeparatorA horizontal separator in a flex column
- With Margins SeparatorA horizontal separator with vertical
- Horizontal SeparatorA horizontal separator that divides a
- List SeparatorHorizontal separators between the rows of
- Standard CardA basic card with a title, a description