A flexible row for lists, settings and menus: media or an icon, a title, a description and actions. Variants default, outline and muted. With href the whole row is a link. Server component, no JavaScript.
Preview
Two-factor authentication
Protect the account with a code from an app.
Installation
Usage
import { ShieldCheck } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item"
export default function Example() {
return (
<Item variant="outline">
<ItemMedia variant="icon">
<ShieldCheck />
</ItemMedia>
<ItemContent>
<ItemTitle>Two-factor authentication</ItemTitle>
<ItemDescription>Protect the account with a code from an app.</ItemDescription>
</ItemContent>
<ItemActions>
<Button size="sm" variant="outline">Enable</Button>
</ItemActions>
</Item>
)
}Examples
Variants
default has no border, outline has a border, muted has a soft fill.
default
2.4 MB
outline
2.4 MB
muted
2.4 MB
<Item variant="outline">…</Item>
<Item variant="muted">…</Item>Link
With href the whole row becomes an <a> with hover and focus styles. Do not put buttons inside such an Item.
<Item variant="outline" href="/projects">
<ItemMedia variant="icon"><Folder /></ItemMedia>
<ItemContent>
<ItemTitle>Projects</ItemTitle>
<ItemDescription>3 active, 1 archived</ItemDescription>
</ItemContent>
<ChevronRight className="size-4" />
</Item>Group
ItemGroup is a column of rows with role="list"; rows inside get role="listitem" from you.
Report.pdf
2.4 MB
Notes.md
18 KB
<ItemGroup aria-label="Documents" className="gap-2">
<Item role="listitem" variant="outline" size="sm">…</Item>
<Item role="listitem" variant="outline" size="sm">…</Item>
</ItemGroup>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "outline" | "muted" | "default" | Visual style |
| size | "default" | "sm" | "default" | Row padding |
| href | string | - | Makes the row a link |
| target / rel | string | - | Passed to the link when href is set |
| ItemMedia variant | "default" | "icon" | "image" | "default" | ItemMedia: default, icon (bordered square) or image (cropped picture) |
| className | string | - | Additional CSS classes |