Separator
Visually or semantically separates content.
Installation
Install the following dependencies:
Set up the token layer and the StyleX compiler, if you have not already. See Installation.
Copy and paste the following code into your project.
Update the import paths to match your project setup.
Usage
Vertical
Use orientation="vertical" for a vertical separator. It stretches to the
height of the flex row it sits in.
A vertical separator has no height of its own. Outside a flex container, or in
a row aligned by anything other than stretch, give it one through xstyle.
Menu
Use vertical separators between menu items with descriptions.
List
Use horizontal separators between list items.
- Item 1
- Value 1
- Item 2
- Value 2
- Item 3
- Value 3
API reference
Pass render to replace a part's element or compose it with another component.
Separator wraps the Base UI Separator and accepts its props. See the
Base UI reference. It renders
a <div role="separator"> with aria-orientation set from the prop.
Separator
| Prop | Type | Default |
|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" |
xstyle | StyleXStyles | — |
className | string | — |
separatorStyles
The style maps behind the component. Spread them onto any element.
| Key | What it is |
|---|---|
base | The fill and flex-shrink: 0 |
orientations | horizontal and vertical: the 1px thickness and the length |
Data attributes
| Attribute | On | Effect |
|---|---|---|
data-slot="separator" | the separator | Targets the rule from a parent |
data-orientation | the separator | Base UI writes it from orientation |