Icon tile
The upstream layout: media, title, description and an action. `variant="icon"` puts the icon on a little slip of paper with a hatched shadow; the title is in the script font.
What a page says when there is nothing on it yet: media, a title in the script font, a line of explanation and an action. The media can be an icon on a slip of paper, Stubby the pencil stub in one of his poses, or a doodle; a `border` draws the sketched, dashed placeholder frame.
npx shadcn@latest add @wobko/empty第一次使用?先把 registry 加进 components.json。 如何安装
The upstream layout: media, title, description and an action. `variant="icon"` puts the icon on a little slip of paper with a hatched shadow; the title is in the script font.
`pose` asks for Stubby, the pencil stub who does the drawing: `search` for no results, `sleep` for a quiet day, `unplug` for offline, and the rest of the poses as they are drawn (see the props). Media is decorative, so the title carries the meaning.
`border` in `className` asks for the sketched dashed frame, with a tick at each corner where the hand marked out the rectangle first. It replaces the CSS border. Here it is a working drop target: drag files over it (it lights up), or use the button; a doodle is the media, and `doodle` takes any name from the Doodle component.
A real use: a filterable list that turns into an empty state when nothing matches, with an action that puts the list back. Type something that is not a name.
shadcn's `empty-icon`: four bare empty states in a two-column grid, each an icon tile, a title and one line. No action, so the page just says what it is missing.
shadcn's `empty-avatar`: `variant="default"` leaves the media bare, so any element can stand there. A face here (initials on marker; the photo of the original is left out so the page needs no network).
shadcn's `empty-avatar-group`: three overlapping faces in the media slot, sized and ringed from the parent with `*:data-[slot=avatar]` selectors, and an invite button.
shadcn's `empty-input-group`: a 404 with no media at all, a search field with a magnifier and a `/` keycap, and a support link under it.
shadcn's `empty-outline`: `border border-dashed` on the root. Here the border is the sketched placeholder frame: a dashed line drawn round the space, as if the thing were to be pasted in.
shadcn's `empty-background`: a soft wash that fades from the muted tone into the paper. Any background utility goes on the root; it is a plain class, nothing is redrawn.
A centered column (gap 6, padding 24, 48 from `md`). Add `border` to `className` and the CSS border becomes a hand-drawn dashed frame with corner ticks; without it nothing is drawn.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| seed | string | number | - | Pins the hand of the frame. Default: derived from useId(). |
The picture above the words (`data-slot="empty-icon"`, as upstream). Children go inside it as they are; `pose` and `doodle` are shortcuts for the art components.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| variant | "default" | "icon" | "default" | `icon` = a 44 px slip of paper with a hatched shadow and the icon (24 px) on it. |
| pose | "idle" | "wave" | "think" | "write" | "sketch" | "celebrate" | "oops" | "shrug" | "sleep" | "peek" | "point" | "carry" | "halt" | "search" | "unplug" | - | Stubby, in a pose. Good matches: `search` no results, `sleep` nothing scheduled, `unplug` offline, `oops` an error, `shrug` not found, `celebrate` all done, `peek` loading, `think` working on it. A pose that has not been drawn yet renders nothing. |
| doodle | string | - | A doodle by name (`paper-plane`, `cat-face`, `balloon`, `sparkle`...). |
| size | number | 96 (Stubby), 80 (doodle) | Pixels tall. Stubby is a sticker whose box includes his white border, redrawn under 28, under 56 and from 140; the master starts at 56. Doodles are redrawn at 48 and below. |
CLI 会复制进你项目的文件。
正在加载源码