Vitral 0.2.18
Messages

EmptyState

What to show where there is nothing yet, or where something just finished: an icon, a line saying what happened, and what to do next.

Import

main.ts
import { EmptyState } from '@vitral/vue';

Basic

No invoices yet

Invoices you send appear here, with whether each was paid.

<script setup lang="ts">import { Button, EmptyState } from '@vitral/vue';</script> <template>    <EmptyState title="No invoices yet" description="Invoices you send appear here, with whether each was paid.">        <template #actions>            <Button label="New invoice" icon="plus" />            <Button label="Import" variant="outlined" severity="secondary" />        </template>    </EmptyState></template>

Results

A `severity` turns an absence into an outcome: the icon and its colour follow it.

Payment received

A receipt is on its way to your email.

The upload failed

The file is larger than 20 MB.

<script setup lang="ts">import { Button, EmptyState } from '@vitral/vue';</script> <template>    <div style="width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem">        <EmptyState severity="success" title="Payment received" description="A receipt is on its way to your email.">            <template #actions><Button label="Back to orders" /></template>        </EmptyState>        <EmptyState severity="danger" title="The upload failed" description="The file is larger than 20 MB.">            <template #actions><Button label="Try another file" severity="danger" variant="outlined" /></template>        </EmptyState>    </div></template>

Small, and aligned to the start

For a panel or a table with no rows: `size="small"` and `align="start"`.

No results for “invoces”

Check the spelling, or search every folder.

<script setup lang="ts">import { Button, EmptyState } from '@vitral/vue';</script> <template>    <EmptyState size="small" align="start" icon="search" title="No results for “invoces”" description="Check the spelling, or search every folder.">        <template #actions><Button label="Search everywhere" size="small" variant="text" /></template>    </EmptyState></template>

API

Read from packages/vue/src/components/EmptyState/types.ts, so it says what the component actually accepts.

Props

NameTypeDescription
title string—
description string—
icon IconProp | falseDefaults to the severity's icon, or an empty tray. `false` draws none.
severity 'success' | 'info' | 'warn' | 'danger'Turns the absence into a result: `success` after something worked, `danger` when it did not. The icon takes the severity's colour.
size Size—
align 'center' | 'start'Defaults to `'center'`.
headingLevel 1 | 2 | 3 | 4 | 5 | 6Make the title a heading of this level, so it takes its place in the page's outline.

Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

Slots

NameSlot propsDescription
default —Replaces the description.
icon ——
title ——
actions —Buttons below the text: what to do about it.