shadcn.io is not affiliated with official shadcn/ui
Item examples · Media
Item with Image Media for React
A list of songs as link items, each with album art, the title and album, the artist and the duration.
A track list where every row opens the song. This React example maps three songs into an ItemGroup, each an outline Item rendered as a link, with grayscale album art in ItemMedia's image variant, the title and album in ItemTitle, the artist in ItemDescription, and the duration in a second ItemContent that doesn't grow.
Preview
Installation
FAQ
What does variant image do for ItemMedia?
It turns ItemMedia into a small square that clips its picture: the image fills it with object-cover, corners follow your style, and the square shrinks at the sm and xs sizes. You only supply the image and its width and height.
What is ItemGroup and when should I use it?
ItemGroup stacks related Items in a column and gives the block the list role. This list sets gap-4 on the group. Add grid classes on ItemGroup when the rows should sit in columns.
How do link rows differ from rows with a button?
Here the whole row is the link, so the title, art and duration are one target, and it gets a muted hover background and a focus ring. When a row needs a separate action, keep it a plain Item and put a Button in ItemActions instead.
How do I show several pieces of metadata in a row?
Put the main line in ItemTitle, the album here in a muted span, the secondary line in ItemDescription, and a short value like the duration in a second ItemContent with flex-none so it stays at its width at the inline end. The title clamps to one line, so long names don't push the duration out.
Related
- Item with Icon MediaA security alert item with a shield icon
- Item with AvatarAn outline item with a person's avatar
- Item as LinkTwo items rendered as links: one to a
- Item with HeaderThree model cards in a grid, each an item
- Basic ItemAn outline item with a title, a one-line
- Item in DropdownA Select button that opens a menu of