Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Separator examples · Basic

List Separator for React

Horizontal separators between the rows of a key and value list.

Framework
UI library

Divide stacked key and value rows without turning them into a table. This React Separator sits between definition list rows (dl, dt, dd) in a flex column, with the value muted at the end of each row. Use it for invoices, order summaries, account details and any short definition list.

Preview

Preview width

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

When should I use list separators instead of a table?

For a short vertical stack of names and values, three to seven rows. Switch to a Table when you have columns, sorting or more than a handful of rows.

Why use dl, dt and dd?

Each row is a name and a value. A definition list tells assistive tech that the two belong together; the Separator only draws the line. A stack of div elements loses that pairing.

How tight should the list be?

gap-2 between rows and lines, as here. At gap-4 the rows start to feel like separate sections rather than one list.

Should the last row have a separator under it?

No. The lines go between rows; a trailing line usually clashes with the card or page edge below the list.

Can list separators be inset?

Yes. The simplest way is horizontal padding on the list, which keeps every line at full width inside it. To inset only the lines, use margins plus a width override, as the Inset Separator example does.

Are list separators announced?

The definition list already expresses the structure, so the lines add nothing for screen reader users. They're exposed as separators; for a long list, borders on the rows are quieter than a Separator between each one.