Skip to content

Empty Content

Empty state with icon, title, description and call to action.

Installation

bun add @xerobi/ui
import { EmptyContent } from "@xerobi/ui/empty-content"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Default

Empty content
No results

Try a different search.

import { EmptyContent } from "@xerobi/ui/empty-content"

export function EmptyContentDefault() {
  return <EmptyContent title="No results" description="Try a different search." />
}

With action

Empty content
No projects yet

Create a project to get started.

import { Button } from "@xerobi/ui/button"
import { EmptyContent } from "@xerobi/ui/empty-content"

export function EmptyContentAction() {
  return <EmptyContent title="No projects yet" description="Create a project to get started." action={<Button>Create project</Button>} />
}

API reference

EmptyContent

PropTypeDescription
titlestring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
descriptionstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
imgUrlstring
filledbooleanDashed, tinted surface instead of a bare layout.
actionstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
slotProps{ img?: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> | undefined; title?: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, H...

Styling hooks: [data-slot="empty-content"].

Search documentation

Search pages, components and blocks.