Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Separator examples · With Text

With Text Left Separator for React

A label at the start of a row with a separator running to the end, to introduce the content below.

Framework
UI library

Lead with the label, then the line. Continue with sits at the start and a Separator with flex-1 runs to the end of the row, so the eye moves on to the block below. Use it for section intros and category labels.

Preview

Preview width
Continue with

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

How is the label pinned to the start?

The span comes first with shrink-0, then a Separator with flex-1. The row is flex items-center gap-2, so the line runs to the end and the words keep their width.

Why does flex-1 matter on the Separator?

Separator includes shrink-0. flex-1 is merged after that class, and cn() keeps flex-1, which sets shrink too. The line then uses the space left after the label.

How is Continue with styled?

The span text is Continue with, with text-xs and text-muted-foreground. Change the text there. A long label leaves little room for the line.

Should this label be a heading?

This demo uses a span. Use a heading element when the words belong in the page outline, and keep shrink-0 on it.

Is the line vertical?

No. orientation stays horizontal, so the separator is one pixel tall. flex-1 grows it across the row.

Are the lines announced with Base UI?

The words beside the line are what people need to hear. The line is exposed to assistive tech. A border is quieter when the line is only visual.