Skip to content

The open alternative to Salesforce, designed for AI.

2.4 KB
Raw Blame
---
title: Separator
description: Separate adjacent content with a horizontal or vertical divider.
---

import { PageBanner } from "/snippets/page-banner.mdx"

import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';

import SeparatorReference from '/snippets/ui/generated/layout/separator.mdx';

## Overview

`Separator` renders a `div` with `role="separator"` and an accessible orientation. It uses the Base UI separator contract, including native props, refs, and `render` composition. Import `SeparatorProps` from the same entry point.

<StoryEmbed
  storyId="ui-layout-separator--display"
  title="Horizontal separator"
  height={130}
/>

## Usage

```tsx
import { Separator } from 'twenty-ui/primitives/layout';
import { Text } from 'twenty-ui/primitives/typography';

export const ImportSources = () => (
  <Text style={{ display: 'grid', gap: 'var(--t-spacing-3)' }}>
    <Text>Import records from a CSV file.</Text>
    <Separator />
    <Text>Connect an external data source.</Text>
  </Text>
);
```

## Orientation and appearance

`orientation` defaults to `horizontal`. Margins default to zero in both orientations. Horizontal separators fill the available width. Vertical separators stretch along their flex container. Give a standalone vertical separator a height. Control spacing through the parent layout, or use native `style` or `className` for explicit margins and line color. Base UI also accepts functions of the orientation for these props.

<StoryEmbed
  storyId="ui-layout-separator--vertical-documentation"
  title="Vertical separator"
  height={150}
/>

## Labeled dividers

Use [LabeledSeparator](/ui/components/layout/labeled-separator) for a text label between divider lines or at the end of a rule. It provides the layout and a single accessible separator name.

```tsx
import { LabeledSeparator } from 'twenty-ui/components/layout';

export const SignInDivider = () => <LabeledSeparator>Or</LabeledSeparator>;
```

## Migration

Replace the former horizontal helper with `Separator`. Remove `noMargin`, since margins now default to zero. To keep the former default spacing, add `style={{ marginBlock: 'var(--t-spacing-3)' }}`. Replace `color` with `style={{ backgroundColor: color }}`. Use `LabeledSeparator` for labeled dividers, pass the label as children, and rename `textPosition` to `labelPosition`. Replace separators used only for invisible spacing with layout spacing.

## Props

<SeparatorReference />

<PageBanner illustration="layout" />