Shows an empty state, such as a list with no items or a search with no results. Compose it from Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, and EmptyContent.
You haven't created any projects yet. Get started by creating your first project.
<script lang="ts">
import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from "#lib/components/ui/empty/index.js";
import { Button } from "#lib/components/ui/button/index.js";
import { FolderCodeIcon } from "@lucide/svelte";
</script>
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon"><FolderCodeIcon /></EmptyMedia>
<EmptyTitle>No projects yet</EmptyTitle>
<EmptyDescription>Get started by creating your first project.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>Create project</Button>
</EmptyContent>
</Empty>pnx remote0 add https://plainsv.com/r/empty.jsonEmpty centers its parts in a column and fills the room of its container. EmptyHeader holds the media, the h3 title, and the muted description in a readable width. EmptyMedia shows an image or avatar as is, or puts an icon on a muted square with variant="icon". EmptyContent holds actions, such as buttons or a search input. Links in the description are underlined.
Set variant="outline" to draw a dashed border, such as around an upload area.
Upload files to your cloud storage to access them anywhere.
<Empty variant="outline">...</Empty>Set size to xs, sm, md, or lg. The default is lg, like the shadcn empty state, and the padding, gaps, text size, and corner radius follow the size.
Size xs.
Size sm.
Size md.
Size lg.
<Empty variant="outline" size="sm">...</Empty>Set rounded to xs through 4xl or pill to override the radius of the outline that follows size. pill is a true pill and can clip tall content, so use 3xl or 4xl for round corners that stay safe.
Rounded xs.
Rounded sm.
Rounded md.
Rounded lg.
Rounded xl.
Rounded 2xl.
Rounded 3xl.
Rounded 4xl.
Rounded pill.
<Empty variant="outline" rounded="sm">...</Empty>Empty, EmptyMedia, and EmptyContent extend the native div attributes. EmptyHeader, EmptyTitle, and EmptyDescription extend the header, h3, and p attributes.
interface Props extends CompPropsWithChild<"div"> {
/** `default` has no border; `outline` draws a dashed border */
variant?: "default" | "outline";
/** Padding, gap, and text size on the shared scale; defaults to `lg` */
size?: UiSize;
/** Corner radius of the outline; follows `size` when omitted. `pill` is a true pill that can clip the content, so use `3xl` or `4xl` to stay round */
rounded?: UiRounded;
}
interface MediaProps extends CompPropsWithChild<"div"> {
/** `default` shows the media as is; `icon` puts an icon on a muted square */
variant?: "default" | "icon";
}