Data display
Layout
Chip
A compact token, optionally removable, for selected filters, tags or values. Use it to show choices people can take back.
Install
import { Chip } from 'vael-ui'Playground
Chip label
undefined
Usage
<script setup lang="ts">
import { Chip } from 'vael-ui'
</script>
<template>
<Chip label="Chip label" />
</template>Motion New
Chip: its appearance and press states.
<Chip
:motion="{ states: { disabled: { root: { scale: 1.04 } } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | rootremove | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
states | disabledfocusactivehover | Sets values per part that hold while a state is on. An array is a set of keyframes that plays once as the state turns on, such as a shake on invalid. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
| Key | Action |
|---|---|
| DeleteBackspace | Fires remove when the chip is removable and focus is on the chip or its remove button. |
| EnterSpace | Fires remove from the focused remove button. |
- The remove button is a
<button>named “Remove” plus thelabel. Passlabeleven when you use the default slot, or the button is named only “Remove”. - When a chip that holds focus is removed, focus moves to the next chip, the previous one, or the field of the Select, CascadeSelect or Combobox it belongs to.
- The chip root is not focusable on its own. Add
tabindex="0"for Delete and Backspace to work on the chip itself. - Inside an element with
role="combobox"orrole="button", such as a Select trigger, the remove button is pointer only (tabindex="-1",aria-hidden). Withdisabled, it is disabled and the keys do nothing.