EmptyState
HkEmptyState is the "nothing here yet" panel: a glyph, an optional heading, a line of supporting copy and one action slot, laid out either as a bounded page card or as a region that stretches to fill its host. The same component also renders the loading variant of that panel.
- A list that adds its next item from inside the content wants an HkAddTile: a dashed tile that shows where the new thing goes, rather than a whole panel explaining the absence.
- A region whose shape is already known is better filled by a HkSkeleton while it loads; the empty state is for when the load came back with nothing.
- A wait that owns the whole surface is an HkLoadingVeil, not an empty state set to loading.
Import
;
use *; // EmptyState, EmptyStateFit
use *; // rsx!, VNode
Title, description and action
title and description are the two lines of copy; both are optional and an empty string renders nothing, so a host may pass through a value it did not compute. The action slot always sits under them in its own box — a Button, a link, a pair of buttons. In the Rust mirror the slot is the action element prop, and the box is rendered even when the slot is empty, exactly like Vue.
No invoices yet
Invoices you issue will be listed here.
Fit and surface
fit chooses the frame: page (the default) is a bounded, centered card for the desktop reading surface, while fill stretches to the host container, which is what a table body or a tab pane wants. boxed draws the component's own surface — background, border, blur — and is off by default because most hosts already bring one; a boxed empty state inside a card reads as a second nested placeholder layer.
Nothing selected
Pick a row to see its details.
No results
No projects
Projects you create appear on this page.
Icon and loading variant
The icon slot replaces the default 48px package glyph; in Vue it is an icon component or any renderable node passed through the slot, in Rust it is the icon element prop. With loading the panel drops the glyph, the copy and the action entirely and shows only a centered spinner, becoming a status region that is busy — the shape a host uses while it re-fetches the same list.
No connections
Connect a workspace to start syncing.
Accessibility
- The loading variant is a status region with aria-busy="true" and a screen-reader-only line of text ("Loading"), because a live region with no text announces nothing when the spinner appears.
- Every other variant is plain content: the title is a paragraph, not a heading, so give the panel a heading of its own in the surrounding page if it needs to appear in that page's outline.
- The action slot is ordinary focusable content; keep exactly one primary action there so the panel reads as a single next step.
- The default glyph is decorative and carries no label — when the absence needs explaining, say it in title / description rather than in the icon.
API
Vue
Props
| Name | Type | Default | Required |
|---|---|---|---|
| title | String | undefined | — |
| description | String | undefined | — |
| icon | [Object, Function] as PropType<Component> | undefined | — |
| loading | Boolean | false | — |
| fit | <code>String as PropType<"page" | "fill"></code> | "page" | — |
| boxed | Boolean | false | — |
Rust
Props — EmptyState
| Prop | Type | Default | Description |
|---|---|---|---|
| title | Option<String> | None | Heading text; absent (or empty) omits p.hk-empty-title — Vue's default is undefined and its template tests truthiness. |
| description | Option<String> | None | Supporting copy; same truthiness rule as title. |
| icon | Option<Element> | None | Icon slot content (wins over nothing else — see the header delta: Vue's props.icon component and its icon slot collapse into this one field). |
| loading | bool | false | Loading variant: only the centered spinner plus the screen-reader text. |
| fit | EmptyStateFit | EmptyStateFit::Page | page (default) or fill. |
| boxed | bool | false | Draw the component's own surface (Vue default false — most hosts bring their own surface). |
| action | Option<Element> | None | Action slot content, rendered inside div.hk-empty-action (non-loading only, even when empty). |
Related components
- HkSkeleton — placeholder shapes for a region that is still loading.
- HkSpinner — the busy indicator the loading variant is built on.
- HkAddTile — an in-content "add" affordance for lists.
- HkLoadingVeil — the blocking overlay for a surface-wide wait.
- Button — the usual occupant of the action slot.
- HkAlert — the message strip for a condition rather than an absence.