Vitral 0.2.18
Mensagens

EmptyState

O que mostrar onde ainda não há nada, ou onde algo acabou de terminar: um ícone, uma linha dizendo o que aconteceu e o que fazer em seguida.

Importação

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

Básico

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>

Resultados

Uma `severity` transforma uma ausência num desfecho: o ícone e a sua cor a acompanham.

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>

Pequeno e alinhado ao início

Para um painel ou uma tabela sem linhas: `size="small"` e `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

Lido de packages/vue/src/components/EmptyState/types.ts, então diz o que o componente aceita de fato.

Props

NomeTipoDescrição
title string—
description string—
icon IconProp | falseO padrão é o ícone da severidade, ou uma bandeja vazia. `false` não desenha nenhum.
severity 'success' | 'info' | 'warn' | 'danger'Transforma a ausência num resultado: `success` depois de algo dar certo, `danger` quando não deu. O ícone assume a cor da severidade.
size Size—
align 'center' | 'start'O padrão é `'center'`.
headingLevel 1 | 2 | 3 | 4 | 5 | 6Faz do título um cabeçalho deste nível, para que ocupe o seu lugar na estrutura da página.

Mais pt, dt e unstyled de BaseProps; veja pass-through e modo sem estilo.

Slots

NomeProps do slotDescrição
default —Substitui a descrição.
icon ——
title ——
actions —Botões abaixo do texto: o que fazer a respeito.