WlIconButton

Square icon button. Can include a count or dot.
Components / Actions v0.1.0

Appearance

Full example
<div class="wl-stack" data-space="md">
  <WlIconButton
    icon="bell"
    aria-label="Notifications"
    :count="3"
    
  />
</div>

Indicators

Full example
<div class="wl-stack" data-space="md">
  <WlIconButton
    icon="bell"
    aria-label="Notifications"
    :count="3"
    
  />
</div>

States

Full example
<div class="wl-stack" data-space="md">
  <WlIconButton
    icon="bell"
    aria-label="Notifications"
    :count="3"
    
  />
</div>

Variants, counts and icons

Ghost, secondary, soft, small size, active, disabled, count/dot and a custom default slot.

neutral
accent
info
success
warning
danger

Click an icon button. Add mode: disabled.

Full example
<script setup lang="ts">
import { WlIcon, WlIconButton, type WlIconButtonVariant, type WlTone } from "legato-ui";
import { ref } from "vue";
const variants = ["ghost", "secondary", "soft"] as const satisfies readonly WlIconButtonVariant[];
const tones = ["neutral", "accent", "info", "success", "warning", "danger"] as const satisfies readonly WlTone[];
const active = ref(false);
const message = ref("Click an icon button.");
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <div class="wl-inline" data-space="md"><WlIconButton
      v-for="variant in variants"
      :key="variant"
      icon="search"
      :variant="variant"
      :aria-label="'Search — ' + variant"
      @click="message = 'Search selected: ' + variant"
    /></div>
    <div class="wl-inline" data-space="md">
      <div
        v-for="tone in tones"
        :key="tone"
        class="wl-inline"
        data-space="xs"
      >
        <WlIconButton
          icon="search"
          variant="soft"
          :tone="tone"
          :aria-label="'Search — ' + tone"
        />
        <span class="wl-text-small">{{ tone }}</span>
      </div>
    </div>
    <div class="wl-inline" data-space="md">
      <WlIconButton
        icon="bell"
        :count="4"
        aria-label="Notifications: 4 unread"
        @click="message = 'Notifications opened'"
      />
      <WlIconButton
        icon="bell"
        dot
        variant="soft"
        aria-label="There are new notifications"
        @click="message = 'New notifications marked as read'"
      />
      <WlIconButton
        icon="user"
        variant="secondary"
        size="sm"
        aria-label="Profile — small button"
        @click="message = 'Profile opened'"
      />
      <WlIconButton
        icon="plus"
        :active="active"
        :aria-pressed="active"
        aria-label="Add mode"
        @click="active = !active"
      />
      <WlIconButton icon="trash" disabled aria-label="Deletion unavailable" />
      <WlIconButton
        aria-label="Favorites — custom slot"
        @click="message = 'Favorites opened'"
      ><WlIcon name="star" :size="18" /></WlIconButton>
    </div>
    <p class="wl-text-small" role="status">
      {{ message }} {{ "Add mode:" }} {{ active ? "enabled" : "disabled" }}.
    </p>
  </div>
</template>