Empty State
MEmptyState gives an empty collection or search a clear explanation and a next action. The app decides when to show it.
Next alpha
Available in 0.1.0-alpha.4.
Usage
<m-empty-state title="Nothing saved yet."
description="Keep a reading for later." icon="bookmark" tone="accent">
<template #actions>
<m-button @click="explore">Explore readings</m-button>
</template>
</m-empty-state>Props
| Prop | Type | Default | Behavior |
|---|---|---|---|
title | string | required | Nonempty heading; blank/missing throws TypeError. |
description | string | empty | Optional guidance below the title. |
icon | IconName | inbox | Default illustration symbol. |
tone | primary / accent | primary | Illustration palette. |
compact | boolean | false | Smaller illustration, heading and spacing. |
titleAs | h1 / h2 / h3 / h4 / h5 / h6 | h2 | Web heading level; native remains a header. |
animated | boolean | true | The artwork's slow float and, on Web with a pointer, its depth. |
width / grow / shrink | dimension / number / number | auto / 0 / context | Layout participation. |
id / accessibilityHidden | string / boolean | — / false | Identifier and accessibility exclusion. |
Slots and behavior
illustration replaces the default artwork. It is always decorative and excluded from accessibility; put meaningful text in the title/description and interactive controls in actions. The default artwork uses themed shapes and an icon, without remote assets.
actions accepts buttons or other appropriate controls. They retain their own events, disabled/loading states and labels. Multiple actions wrap when necessary. There is no default slot and no component event.
Text and layout grow naturally, including long translations and larger system text on native. Use compact inside smaller sections. The component does not fetch data, infer loading/error states, announce updates, move focus or start motion automatically. Use Skeleton for loading, Alert for inline messages, and app-owned focus or live feedback when a changing result needs it.
Library combines topic chips, search and empty saved readings with recovery actions.
Motion
The empty state arrives in stages: the artwork pops, then the title, description and actions rise in order. The artwork floats slowly only while it is on screen, in the foreground and without reduced motion. On Web, a hovering pointer gives the icon and accent dot a little depth. Server-rendered content is not replayed on hydration.
Full example
View source
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { computed, ref } from 'vue'
import { useMavisTheme } from '@getcortexlabs/mavis-core/vue'
const { t, locale } = useCatalogLocale(() => props.lang)
const props = withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: undefined })
const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const { theme } = useMavisTheme()
const created = ref(false)
</script>
<template>
<m-column gap="lg">
<m-column padding="lg" gap="sm" radius="lg" :backgroundColor="theme.colors.accentSoft">
<m-text variant="overline" tone="accent">{{
t(pt ? 'TODO COMEÇO TEM ESPAÇO' : 'ROOM FOR A BEGINNING')
}}</m-text>
<m-text variant="title">{{
t(pt ? 'A próxima ideia é sua.' : 'Your next idea starts here.')
}}</m-text>
</m-column>
<m-card padding="none">
<m-empty-state
v-if="!created"
:title="t(pt ? 'Uma coleção à sua espera.' : 'A collection waiting for you.')"
:description="
t(
pt
? 'Guarde referências, descobertas e tudo o que vale uma segunda olhada.'
: 'Keep references, discoveries and everything worth a second look.',
)
"
icon="bookmark"
tone="accent"
>
<template #actions
><m-button icon="plus" @click="created = true">{{
t(pt ? 'Criar coleção' : 'Create collection')
}}</m-button></template
>
</m-empty-state>
<m-column v-else padding="lg" gap="md">
<m-icon name="check" tone="accent" size="lg" />
<m-text variant="heading">{{
t(pt ? 'Primeira coleção criada.' : 'First collection created.')
}}</m-text>
<m-button variant="ghost" @click="created = false">{{
t(pt ? 'Recomeçar' : 'Start again')
}}</m-button>
</m-column>
</m-card>
<m-card padding="none">
<m-empty-state
compact
:title="t(pt ? 'Nenhum resultado por enquanto.' : 'No results yet.')"
:description="
t(
pt
? 'Uma palavra diferente pode abrir novos caminhos.'
: 'A different word can open new paths.',
)
"
icon="search"
/>
</m-card>
<m-empty-state
compact
:title="t(pt ? 'Seu próximo capítulo.' : 'Your next chapter.')"
:description="
t(
pt
? 'Uma ilustração própria também pode contar essa história.'
: 'Your own illustration can tell this story too.',
)
"
>
<template #illustration>
<m-row gap="sm" align="end">
<m-box :width="28" :height="48" radius="sm" :backgroundColor="theme.colors.primarySoft" />
<m-box :width="28" :height="64" radius="sm" :backgroundColor="theme.colors.primary" />
<m-box :width="28" :height="40" radius="sm" :backgroundColor="theme.colors.accent" />
</m-row>
</template>
</m-empty-state>
</m-column>
</template>On Web and NativeScript the artwork's idle movement takes 3.6 seconds per cycle. Setting :animated="false" returns the illustration to its resting position.