Server Component · 0 KB client JS
Empty State
A placeholder for "no results", "nothing here yet" and recoverable-error moments. Pure composition: the whole compound renders as a Server Component and ships zero client JavaScript. Size travels to the parts via a data attribute, not context.
No messages yet
When someone writes to you, the conversation will show up here.
import { EmptyState, Button } from "astralis-ui";
import { Inbox } from "lucide-react";
// No "use client": EmptyState is pure composition and ships zero client JS.
export function EmptyStateDemo() {
return (
<EmptyState>
<EmptyState.Indicator>
<Inbox />
</EmptyState.Indicator>
<EmptyState.Title>No messages yet</EmptyState.Title>
<EmptyState.Description>
When someone writes to you, the conversation will show up here.
</EmptyState.Description>
<EmptyState.Actions>
<Button size="sm">New message</Button>
<Button size="sm" variant="outline" colorScheme="gray">
Invite people
</Button>
</EmptyState.Actions>
</EmptyState>
);
}No messages yet
When someone writes to you, the conversation shows up here.
size
import { Button, EmptyState } from "astralis-ui";
<EmptyState>
<EmptyState.Indicator>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M22 12h-6l-2 3h-4l-2-3H2" />
<path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" />
</svg>
</EmptyState.Indicator>
<EmptyState.Title>No messages yet</EmptyState.Title>
<EmptyState.Description>When someone writes to you, the conversation shows up here.</EmptyState.Description>
<EmptyState.Actions>
<Button size="sm">New message</Button>
</EmptyState.Actions>
</EmptyState>
Import#
import { EmptyState } from "astralis-ui";Sizes#
No results
size="sm"
No results
size="md"
No results
size="lg"
import { EmptyState, Flex } from "astralis-ui";
import { SearchX } from "lucide-react";
export function EmptyStateSizes() {
return (
<Flex gap="6" alignItems="start" wrap="wrap">
{(["sm", "md", "lg"] as const).map((size) => (
<EmptyState key={size} size={size}>
<EmptyState.Indicator>
<SearchX />
</EmptyState.Indicator>
<EmptyState.Title>No results</EmptyState.Title>
<EmptyState.Description>size="{size}"</EmptyState.Description>
</EmptyState>
))}
</Flex>
);
}Props#
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | "md" | Scales the indicator, title and description together. |
Parts#
| Prop | Type | Default | Description |
|---|---|---|---|
EmptyState.Indicator | div props | None | Muted circle around an icon. Hidden from assistive technology, since the icon is decorative. |
EmptyState.Title | div props | None | The headline. It isn't a heading element, so wrap it in one when it should appear in the outline. |
EmptyState.Description | div props | None | Supporting copy, capped at a readable line length. |
EmptyState.Actions | div props | None | A wrapping row for one or two Buttons. |