- Components
Empty state
What a list or page shows when there is nothing yet: an icon, one sentence and one next step.
npx shadcn add @klarhimmel/empty-state @klarhimmel/buttonWhen to use
Use for
A first-run list, an empty search, a cleared inbox.
Not for
Errors. Use a Banner. Not for loading. Use Skeleton.
Pairs with
Button, Card, lists and tables.
Preview
No bookings yet
Bookings appear here as soon as a guest reserves a room.
empty-state.tsx
import { Inbox } from 'lucide-react';
import { Theme } from '@/components/klarhimmel/theme/style';
import { Button } from '@/components/klarhimmel/ui/button';
import { EmptyState } from '@/components/klarhimmel/ui/empty-state';
export default function Example() {
return (
<Theme theme="brand">
<EmptyState icon={<Inbox />} title="No bookings yet" action={<Button>Add a booking</Button>}>
Bookings appear here as soon as a guest reserves a room.
</EmptyState>
</Theme>
);
}Install
Import
import { EmptyState } from '@/components/klarhimmel/ui/empty-state';- Lands in
- components/klarhimmel/ui/empty-state.tsx, plus cn() and the theme item if they are missing. Import theme.css after Tailwind.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Examples
Search
No rooms match "balcony sauna"
Try fewer words, or clear the filters to see all 12 rooms.
import { SearchX } from 'lucide-react'; import { Button } from '@/components/klarhimmel/ui/button'; import { EmptyState } from '@/components/klarhimmel/ui/empty-state'; export default function EmptyStateSearch() { return ( <EmptyState level={2} icon={<SearchX />} title={'No rooms match "balcony sauna"'} description="Try fewer words, or clear the filters to see all 12 rooms." action={<Button variant="secondary">Clear filters</Button>} /> ); }Compact
No messages from guests
New messages show up here. You will also get an email.
import { Card } from '@/components/klarhimmel/ui/card'; import { EmptyState } from '@/components/klarhimmel/ui/empty-state'; export default function EmptyStateCompact() { return ( <Card className="w-full max-w-md p-2"> <EmptyState level={4} title="No messages from guests" description="New messages show up here. You will also get an email." /> </Card> ); }
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | - | Required. The heading. |
description / children | ReactNode | - | One sentence under the title. |
icon | ReactNode | - | A lucide icon element. |
action | ReactNode | - | The next step, usually a Button. |
level | 2 | 3 | 4 | 3 | Heading level, to fit the page outline. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves to the action button, if there is one |
Enter / Space | Activates the action |
The title is a heading (level 3 by default; set level to fit the page outline). The icon is hidden from assistive tech.
Accessibility