Skip to content

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.

empty-basic.html
<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>

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.

empty-outline.html
<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>

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.

empty-no-results.html
<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>

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:

Terminal
npx @vinish/ui add empty
React
import { Empty } from "@/components/vin/empty";
Vue
import Empty from "@/components/vin/empty.vue";
Svelte
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.

PropValuesDefaultIn HTML
variantdefaultoutlinedefaultvin-empty--outline
iconReactNode—.vin-empty__media > svg
titleReactNode—.vin-empty__title
descriptionReactNode—.vin-empty__description
actionsReactNode—.vin-empty__actions

Parts

React, Vue, SvelteHTML 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.