Empty state
Explains why a view is empty and what to do next.
Example
Reports you create will appear here.
<focsd-empty-state headline="No reports yet" icon="search"> <p>Reports you create will appear here.</p> <focsd-button slot="actions" variant="action">Create report</focsd-button></focsd-empty-state>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-empty-state.js';</script>
<focsd-empty-state headline="No reports yet" icon="search">…</focsd-empty-state>import { EmptyState } from '@focsd-dev/react';
export function Example() { return <EmptyState headline="No reports yet" icon="search">…</EmptyState>;}<script setup>import '@focsd-dev/components/focsd-empty-state.js';</script>
<template> <focsd-empty-state headline="No reports yet" icon="search">…</focsd-empty-state></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-empty-state.js';
// template<focsd-empty-state headline="No reports yet" icon="search">…</focsd-empty-state><script> import '@focsd-dev/components/focsd-empty-state.js';</script>
<focsd-empty-state headline="No reports yet" icon="search">…</focsd-empty-state>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
headline | headline | string | — |
level | level | number | 2 |
icon | icon | string | — |
icon-library | iconLibrary | string | — |
Slots
| Slot | Description |
|---|---|
(default) | Default content. |
actions | Buttons or links for the next step. |
icon | Any icon markup (an SVG, an icon component, an icon-font element), instead of icon. |
CSS parts
Style the inside of the component with ::part(), for example focsd-empty-state::part(actions).
| Part | Description |
|---|---|
actions | The actions element. |
body | The body element. |
empty | The empty element. |
headline | The headline element. |
icon | The icon element. |
Accessibility
- A real heading (level from
level, default 2) so the state is discoverable by heading navigation. - Not a live region: announce changes elsewhere if content disappears after an action.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.