WlChip

Chip with a toggleable selected state. Can include a count.
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

count

Trailing count.

removeLabel

Accessible name of the removal action.

Disables the chip.

Show a removal action for this chip.

Props active, size, density, pt, 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 { WlButton, WlChip } from "legato-ui";
import { ref } from "vue";
const active = ref(false);
const visible = ref(true);
</script>

<template>
  <div class="wl-stack" data-space="md">
    <WlChip
      v-if="visible"
      v-model:active="active"
      :count="5"
      removable
      size="sm"
      remove-label="Remove Design tag"
      
      @remove="visible = false"
    >{{ "Design" }}</WlChip>
    <WlButton v-else size="sm" @click="visible = true">{{ "Restore tag" }}</WlButton>
  </div>
</template>

Independent filters

Active, count including zero, disabled, named models and clearing all filters.

Filters: Design.

Vue SFC · additional example
<script setup lang="ts">
import { WlButton, WlChip } from "legato-ui";
import { computed, ref } from "vue";
const design = ref(true);
const development = ref(false);
const review = ref(false);
const selected = computed(() => [[design.value, "Design"], [development.value, "Development"], [review.value, "Review"]].filter(([active]) => active).map(([, label]) => label).join(", "));
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <div class="wl-inline" data-space="sm">
      <WlChip v-model:active="design" :count="7">{{ "Design" }}</WlChip>
      <WlChip v-model:active="development" :count="23">{{ "Development" }}</WlChip>
      <WlChip v-model:active="review" :count="0">{{ "Review" }}</WlChip>
      <WlChip disabled>{{ "Archive" }}</WlChip>
    </div>
    <div>
      <WlButton size="sm" variant="ghost" @click="design = false; development = false; review = false">
        {{ "Clear all filters" }}
      </WlButton>
    </div>
    <p class="wl-text-small" role="status">{{ "Filters:" }} {{ selected || "none selected" }}.</p>
  </div>
</template>