WlIconButton

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

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

Settings

variant

Visual variant.

size

Button size.

icon

Icon (when no slot is provided).

count

Numeric badge (shown when > 0).

ariaLabel

Action name. With icon, provide ariaLabel, native aria-label/aria-labelledby or a named pt.root. Without icon, default-slot text can name the action; badge and tooltip text remain descriptions.

countLabel

Badge description; the action still needs its own accessible name.

dotLabel

Accessible description for a meaningful status dot.

Highlight as active.

Disables the button.

Indicator dot (when count is absent).

Indicate pending work supplied by the application.

Props pt, tone, href, to, models, handlers and slots can be edited in the SFC. See their descriptions in API.

Example

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 { WlIconButton } from "legato-ui";
</script>

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

Variants, counts and icons

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

Click an icon button. Add mode: disabled.

Vue SFC · additional example
<script setup lang="ts">
import { WlIcon, WlIconButton, type WlIconButtonVariant } from "legato-ui";
import { ref } from "vue";
const variants = ["ghost", "secondary", "soft"] as const satisfies readonly WlIconButtonVariant[];
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">
      <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>