EmptyState
EmptyState explains why a list, table or record view has no content yet. Give it an icon, a title, a short description and an optional action.
Add your first contact to start building your CRM.
This example also needs: Button.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Without action
Leave out EmptyStateContent when there is no action to offer.
Try adjusting your filters or search terms.
This example also needs:
Title as heading
Use asChild on EmptyStateTitle to render a real h2 that names its section.
No contacts yet
The empty-state title can be the section heading without adding a duplicate hidden heading.
This example also needs:
Bordered
Set bordered to add a dashed frame around the empty state.
Add your first contact to get started.
This example also needs:
All variants
Compare the icon and default media variants, with and without a frame.
Add your first contact to get started.
Try adjusting your filters.
Props
EmptyState
| Prop | Type | Default | Description |
|---|---|---|---|
bordered | boolean | false | Adds a dashed frame. Match a bordered skeleton so swapping from loading doesn't shift the layout. |
EmptyStateContent
EmptyStateContent adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateDescription
EmptyStateDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateHeader
EmptyStateHeader adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateMedia
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "icon" | null | "default" | No description |
EmptyStateTitle
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Applies the title styles to a child element, such as an |
EmptyState explains why a list, table or record view has no content yet. Give it an icon, a title, a short description and an optional action.
This example also needs: Button.
Installation
Install the following dependencies:
Copy and paste the following code into your project.
components/empty-state/EmptyState.vue components/empty-state/EmptyStateContent.vue components/empty-state/EmptyStateDescription.vue components/empty-state/EmptyStateHeader.vue components/empty-state/EmptyStateMedia.vue components/empty-state/EmptyStateTitle.vue components/empty-state/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Without action
Leave out EmptyStateContent when there is no action to offer.
Title as heading
Use as-child on EmptyStateTitle to render a real h2 that names its section.
Bordered
Set bordered to add a dashed frame around the empty state.
All variants
Compare the icon and default media variants, with and without a frame.
Props
EmptyState
| Prop | Type | Default | Description |
|---|---|---|---|
bordered | boolean | false | Adds a dashed frame. Match a bordered skeleton so swapping from loading doesn't shift the layout. |
EmptyStateContent
EmptyStateContent adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateDescription
EmptyStateDescription adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateHeader
EmptyStateHeader adds no props of its own; it accepts the props of the element or primitive it wraps.
EmptyStateMedia
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "icon" | null | "default" | No description |
EmptyStateTitle
EmptyStateTitle adds no props of its own; it accepts the props of the element or primitive it wraps.