Empty
What to show when there's nothing yet: an icon, a short explanation and the next step. Same markup and props in every style: switch the style in the header to see it change.
Basic
Say what would be here and offer the first step.
No projects yet
Projects keep your components and theme together. Create one to get started.
<div class="vin-empty" style="max-width: 420px">
<div class="vin-empty__media"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20h16a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-8l-2-3H4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1z"/></svg></div>
<p class="vin-empty__title">No projects yet</p>
<p class="vin-empty__description">Projects keep your components and theme together. Create one to get started.</p>
<div class="vin-empty__actions">
<button type="button" class="vin-btn">Create project</button>
<button type="button" class="vin-btn vin-btn--outline">Import</button>
</div>
</div>No projects yet
Projects keep your components and theme together. Create one to get started.
import { Empty } from "@/components/vin/empty";
import { Button } from "@/components/vin/button";
export function EmptyBasic() {
return (
<Empty
style={{ maxWidth: 420 }}
icon={<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 20h16a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-8l-2-3H4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1z" /></svg>}
title="No projects yet"
description="Projects keep your components and theme together. Create one to get started."
actions={<><Button>Create project</Button><Button variant="outline">Import</Button></>}
/>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Empty from "@/components/vin/empty.vue";
import Button from "@/components/vin/button.vue";
</script>
<template>
<Empty title="No projects yet" description="Projects keep your components and theme together. Create one to get started." style="max-width: 420px">
<template #icon><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20h16a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-8l-2-3H4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1z" /></svg></template>
<template #actions>
<Button>Create project</Button>
<Button variant="outline">Import</Button>
</template>
</Empty>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Empty from "$lib/components/vin/empty.svelte";
import Button from "$lib/components/vin/button.svelte";
</script>
<Empty style="max-width: 420px" title="No projects yet" description="Projects keep your components and theme together. Create one to get started.">
{#snippet icon()}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 20h16a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-8l-2-3H4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1z" /></svg>{/snippet}
{#snippet actions()}<Button>Create project</Button><Button variant="outline">Import</Button>{/snippet}
</Empty>Outline
A dashed frame, for an area that will fill up, like an upload zone.
Drop files here
PNG, JPG or PDF, up to 10 MB each.
<div class="vin-empty vin-empty--outline" style="max-width: 420px">
<div class="vin-empty__media"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 15V3"/><path d="m7 8 5-5 5 5"/><path d="M5 15v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4"/></svg></div>
<p class="vin-empty__title">Drop files here</p>
<p class="vin-empty__description">PNG, JPG or PDF, up to 10 MB each.</p>
<div class="vin-empty__actions">
<button type="button" class="vin-btn vin-btn--outline vin-btn--sm">Choose files</button>
</div>
</div>Drop files here
PNG, JPG or PDF, up to 10 MB each.
import { Empty } from "@/components/vin/empty";
import { Button } from "@/components/vin/button";
export function EmptyOutline() {
return (
<Empty
variant="outline"
style={{ maxWidth: 420 }}
icon={<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 15V3" /><path d="m7 8 5-5 5 5" /><path d="M5 15v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4" /></svg>}
title="Drop files here"
description="PNG, JPG or PDF, up to 10 MB each."
actions={<Button variant="outline" size="sm">Choose files</Button>}
/>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Empty from "@/components/vin/empty.vue";
import Button from "@/components/vin/button.vue";
</script>
<template>
<Empty variant="outline" title="Drop files here" description="PNG, JPG or PDF, up to 10 MB each." style="max-width: 420px">
<template #icon><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 15V3" /><path d="m7 8 5-5 5 5" /><path d="M5 15v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4" /></svg></template>
<template #actions><Button variant="outline" size="sm">Choose files</Button></template>
</Empty>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Empty from "$lib/components/vin/empty.svelte";
import Button from "$lib/components/vin/button.svelte";
</script>
<Empty variant="outline" style="max-width: 420px" title="Drop files here" description="PNG, JPG or PDF, up to 10 MB each.">
{#snippet icon()}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 15V3" /><path d="m7 8 5-5 5 5" /><path d="M5 15v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4" /></svg>{/snippet}
{#snippet actions()}<Button variant="outline" size="sm">Choose files</Button>{/snippet}
</Empty>No results
In a card, after a search finds nothing. Offer a way back.
No results for “astro”
Check the spelling or try a shorter word.
<div class="vin-card" style="width: 100%; max-width: 420px">
<div class="vin-empty">
<div class="vin-empty__media"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg></div>
<p class="vin-empty__title">No results for “astro”</p>
<p class="vin-empty__description">Check the spelling or try a shorter word.</p>
<div class="vin-empty__actions">
<button type="button" class="vin-btn vin-btn--ghost vin-btn--sm">Clear search</button>
</div>
</div>
</div>No results for “astro”
Check the spelling or try a shorter word.
import { Card } from "@/components/vin/card";
import { Empty } from "@/components/vin/empty";
import { Button } from "@/components/vin/button";
export function EmptyNoResults() {
return (
<Card style={{ width: "100%", maxWidth: 420 }}>
<Empty
icon={<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg>}
title="No results for “astro”"
description="Check the spelling or try a shorter word."
actions={<Button variant="ghost" size="sm">Clear search</Button>}
/>
</Card>
);
}The Vue version renders the same markup as the HTML tab, so it looks and works the same.
<script setup lang="ts">
import Card from "@/components/vin/card.vue";
import Empty from "@/components/vin/empty.vue";
import Button from "@/components/vin/button.vue";
</script>
<template>
<Card style="width: 100%; max-width: 420px">
<Empty title="No results for “astro”" description="Check the spelling or try a shorter word.">
<template #icon><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg></template>
<template #actions><Button variant="ghost" size="sm">Clear search</Button></template>
</Empty>
</Card>
</template>The Svelte version renders the same markup as the HTML tab, so it looks and works the same.
<script lang="ts">
import Card from "$lib/components/vin/card.svelte";
import Empty from "$lib/components/vin/empty.svelte";
import Button from "$lib/components/vin/button.svelte";
</script>
<Card style="width: 100%; max-width: 420px">
<Empty title="No results for “astro”" description="Check the spelling or try a shorter word.">
{#snippet icon()}<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7" /><path d="m20 20-3.5-3.5" /></svg>{/snippet}
{#snippet actions()}<Button variant="ghost" size="sm">Clear search</Button>{/snippet}
</Empty>
</Card>Installation
React, Vue and Svelte: add the component to your project with the CLI. It reads your framework from vin.json and also copies any component this one needs. Then import it:
npx @vinish/ui add emptyimport { Empty } from "@/components/vin/empty";import Empty from "@/components/vin/empty.vue";import Empty from "$lib/components/vin/empty.svelte";The import paths assume the default folders: @/components/vin (React and Vue, with the usual @ → src alias) and $lib/components/vin (SvelteKit). Use your own if you chose another folder in init. How the Vue and Svelte versions pass values and content is in Frameworks.
Plain HTML: the classes come with the style's stylesheet. It needs no JavaScript.
API
From spec/empty.json, which every framework version is tested against.
| Prop | Values | Default | In HTML |
|---|---|---|---|
variant | defaultoutline | default | vin-empty--outline |
icon | ReactNode | — | .vin-empty__media > svg |
title | ReactNode | — | .vin-empty__title |
description | ReactNode | — | .vin-empty__description |
actions | ReactNode | — | .vin-empty__actions |
Parts
| React, Vue, Svelte | HTML classes |
|---|---|
<Empty> | .vin-empty.vin-empty--outline.vin-empty__media.vin-empty__title.vin-empty__description.vin-empty__actions |
Accessibility
- The title is plain text (not a heading by default) so it doesn't break the page outline. Pass as="h2" or h3 when it heads a section.
- The icon is decorative and hidden from screen readers.
- After a search, put the result count or this message in a live region so screen-reader users hear that nothing was found.
Customize
Saved in this browser. Style and accent are in the header.