WlEmpty

Empty state: icon, title, description, action.
Components / Data v0.1.0

Change props to see the result: the example and code use the same settings. “Reset” restores the initial values.

Settings

icon

Icon (when no icon slot is provided).

title

Title.

description

Description (when no slot is provided).

Example

No materials yet
Create the first material.
Focus: outside the example · pointer: outside the example

Explore the live example and copy its Vue SFC into your application. Settings on the left can be combined.

Code for your application

Vue SFC · current settings
<script setup lang="ts">
import { WlButton, WlEmpty } from "legato-ui";
import { ref } from "vue";
const added = ref(false);
</script>

<template>
  <div class="wl-stack" data-space="md">
    <WlEmpty
      v-if="!added"
      icon="file"
      title="No materials yet"
      description="Create the first material."
      
    ><template #action><WlButton @click="added = true">{{ "Add material" }}</WlButton></template></WlEmpty>
    <p v-else role="status">{{ "Material added." }}</p>
  </div>
</template>

No data, no results and custom slot

Adding the first article, clearing search, repeating the empty state, icon/default/action.

No materials yet
Add your first material.
Nothing found
No results for «archive».
Choose a folder

The default slot lets you add a documentation link and your own instructions.

Vue SFC · additional example
<script setup lang="ts">
import { WlButton, WlEmpty, WlIcon, WlTag } from "legato-ui";
import { ref } from "vue";
const created = ref(false);
const query = ref("archive");
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <WlEmpty
      v-if="!created"
      icon="file"
      title="No materials yet"
      description="Add your first material."
    >
      <template #action>
        <WlButton size="sm" variant="primary" @click="created = true">{{ "Add first material" }}</WlButton>
      </template>
    </WlEmpty>
    <div v-else class="wl-inline" data-space="sm">
      <WlTag color="green">{{ "First material added" }}</WlTag>
      <WlButton size="sm" variant="ghost" @click="created = false">{{ "Clear local list" }}</WlButton>
    </div>
    <WlEmpty
      v-if="query"
      icon="search"
      title="Nothing found"
      :description="'No results for «' + query + '».'"
    >
      <template #action>
        <WlButton size="sm" @click="query = ''">{{ "Clear search query" }}</WlButton>
      </template>
    </WlEmpty>
    <p v-else class="wl-text-body">{{ "Search cleared: all materials are available." }}</p>
    <WlEmpty title="Choose a folder">
      <template #icon><WlIcon name="folder" :size="36" /></template>
      <p>
        {{ "The default slot lets you add" }}
        <a href="?view=docs">{{ "a documentation link" }}</a>
        {{ "and your own instructions." }}
      </p>
    </WlEmpty>
  </div>
</template>