Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Item examples · Standard

Basic Item for React

An outline item with a title, a one-line description and an Action button.

Framework
UI library

The simplest useful row: a title, a line of context and one action. This React example puts ItemTitle and ItemDescription in ItemContent, and an outline Button in ItemActions, all inside an outline Item with a bg-background class so the border reads on any surface. Start here for settings rows, file lists or notification entries, then add media or turn the row into a link as the other examples do.

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 an Item instead of a Card or a plain div?

Use an Item for a compact row (media, title, description, actions) that repeats in a list. Use a Card when the block is a subject of its own with a header, body and footer. A plain div is fine for a one-off layout, but you lose the shared spacing and slots.

What does the outline variant do?

variant takes default, outline or muted. default has a transparent border, outline draws a border, and muted fills the row with a light muted background. The example also adds bg-background so the outlined row is opaque on a tinted page.

What belongs in ItemActions?

Controls that act on the row: a button, an icon button, a menu trigger, or a chevron or badge that hints at what happens. ItemActions lays its children out in a row with a small gap, and ItemContent grows to push it to the inline end. Keep the main text in ItemContent so the actions stay small.

Does every Item need an ItemDescription?

No. Leave it out when the title says enough. When you include it, keep it short: ItemDescription is clamped to two lines and ItemTitle to one.

Should the whole Item be clickable, or just the button?

Make the whole row a link when the title and description are one destination. Keep a separate button, as here, when the action does something else. A button inside a row that is itself a link is invalid.

How do screen readers read an Item?

Item is a div, so the title and description are read as text in order and the button is announced with its label. Give the button a label that makes sense out of context, or an aria-label that names the row, when several rows share the same button text. For a list of rows, wrap them in ItemGroup, which has the list role.