Variants and sizes
Bare, outlined in ruled pencil, and washed in paper-shade. The small size trims the padding. None of these rows draws an svg: the pencil is CSS.
A row for lists of things: an icon or photo, a title with a line of description, some actions. Rows sit on ruled paper, a link row lights up under a highlighter swipe, and none of it carries ink of its own, so a list of hundreds costs nothing.
npx shadcn@latest add @wobko/item第一次使用?先把 registry 加进 components.json。 如何安装
Bare, outlined in ruled pencil, and washed in paper-shade. The small size trims the padding. None of these rows draws an svg: the pencil is CSS.
ruled puts a blue pencil line under every row, so the rules always match the rows. Link rows (asChild) light up under a highlighter swipe when you point at them, and take the focus ring from the keyboard.
Rows doing real work in a card: photographs that lie a little crooked, a status badge in the title, actions on the right, and a header and footer on the row that needs them.
shadcn's `item-demo`: an outlined row with a title, a description and a button, and a small row made a link with `asChild`, a verified badge in front and a chevron behind. The pencil outline is CSS, so a long list costs no svg.
shadcn's `item-size` (its source is the same two rows as the demo): `default` gives a row 16 px of padding, `sm` trims it. Here the same content is set at both sizes, one under the other, so the difference is easy to see.
shadcn's `item-variant`: `default` is bare, `outline` has a ruled pencil line round it, `muted` is a wash of paper-shade. The same three words as upstream.
shadcn's `item-icon`: `ItemMedia variant="icon"` sets a glyph in a square of its own at the start of the row.
shadcn's `item-image`: a list of tracks, each a link row with a small picture (`variant="image"`), a title with the album in muted type, the artist below and the running time at the far end. The pictures are doodles, pasted in a little crooked; the original's `role="listitem"` is not needed, the group already makes each link one.
shadcn's `item-avatar`: a single face with a round invite button, and a stack of faces (the first two hide below `sm`) beside an invite text button. Faces are initials on marker; the photographs of the original are left out.
shadcn's `item-group`: ItemGroup makes the rows a list and ItemSeparator draws the pencil line between them (the last row has none). Nothing here is an svg per row.
shadcn's `item-header`: ItemHeader takes the first, full-width line of a row, so a picture sits above the words. Three cards in a grid; the photographs of the original are doodles here.
shadcn's `item-dropdown`: each menu row is an Item (`className="p-0"` on the menu item, `p-2` on the Item), so a menu can show a face, a name and a line of detail. Arrow keys and typeahead still belong to the menu.
shadcn's `item-link`: `asChild` turns the row into an `<a>`. The row gets the highlighter swipe on hover and a focus outline; an external link carries `target="_blank"` and `rel`.
A flex row (a div, or your own element with asChild). The ruled pencil box of variant=outline, the wash of muted and the highlighter hover of a link or button row are CSS (masks made from a few tiny drawn tiles, defined once per page in one hoisted stylesheet), never an svg per row. Inside an ItemGroup it is a list item; an asChild row is wrapped in one, so the link keeps its own role.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| variant | "default" | "outline" | "muted" | "default" | default = bare; outline = a ruled pencil box whose corners meet (three hands, by seed); muted = a paper-shade wash with rounded corners. |
| size | "default" | "sm" | "default" | Roomy (gap 16, padding 16) or snug (gap 10, padding 16 x 12). Compact and calm density are a step tighter each. |
| asChild | boolean | false | Render your own element (a link, a button); it hovers under the highlighter swipe, and takes the focus ring. |
| seed | string | number | - | Picks which of the three hands draws this row's outline and rule. Default: derived from useId(). |
A role=list column of rows.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| ruled | boolean | false | Ruled paper: a blue pencil line under each row, drawn by the stylesheet so it always matches the height of the row. |
The leading (or trailing) picture.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| variant | "default" | "icon" | "image" | "default" | icon = a 36 px well with a ruled box and a paper-shade wash; image = a 40 px photograph with a white border that lies a degree crooked (alternating rows, straight in calm density). |
CLI 会复制进你项目的文件。
正在加载源码