shadcn.io is not affiliated with official shadcn/ui
Item examples · Media
Item with Icon Media for React
A security alert item with a shield icon, a short message and a Review button.
A notice that belongs in a list rather than a banner: a shield icon, Security Alert, New login detected from unknown device, and a Review button. This React example uses ItemMedia with variant="icon" for the shield, ItemContent for the text and an outline Button in ItemActions, on an outline Item.
Preview
Installation
FAQ
What does variant icon do for ItemMedia?
It sizes an icon that has no size class of its own to size-4, so icons line up from row to row without classes on each. When the row has a description, ItemMedia also moves to the top so the icon lines up with the title.
What icons work best in ItemMedia?
Simple ones that say what kind of row it is: a shield for security, a bell for a notification, a file for a document. The icon is decorative here, marked aria-hidden="true", because the title says what it means.
When should ItemMedia hold an icon and when an avatar?
An avatar when the row is about a person. An icon, as with this shield, when the row is a system event, a setting, or a file type. For a picture, set ItemMedia variant to image.
What actions suit an alert row?
One clear next step, Review here, as a small outline button. A second, quieter action such as Dismiss can sit beside it in ItemActions, which spaces its children with a small gap.
Related
- Item with AvatarAn outline item with a person's avatar
- Item with Image MediaA list of songs as link items, each with
- Item with Media and IconA small link item with a verified badge
- Standard with Title AlertA neutral alert with only a title, for a
- Item as LinkTwo items rendered as links: one to a
- Item in DropdownA Select button that opens a menu of