vael-ui v0.5.7

Data display

Layout

Tag

A compact label that categorizes or annotates an item inline. Use it for statuses, categories and keywords.

Install

import { Tag } from 'vael-ui'

Playground

Tag
Usage
<script setup lang="ts">
import { Tag } from 'vael-ui'
</script>

<template>
  <Tag>Tag</Tag>
</template>

Props

NameTypeDefaultDescription
variant'primary' | 'danger' | 'muted' | 'success' | 'warning' | 'info''muted'Color variant.
size'sm' | 'md''md'Text size and padding.
pillbooleanfalseFully pill-rounded instead of the default small label corners.
uiPartial<Record<'root' | 'icon' | 'label', UiPartValue>>Class and style overrides for each part.
motionTagMotionHow it moves: its appearance ({ initial: { root: { opacity: 0, scale: 0.9 } } }) and its press states ({ states: { active: { root: { scale: '0.96' } } } }). false turns its own animation off.

Events

No events.

Slots

NameTypeDescription
defaultanyTag label.
iconanySmall leading glyph, such as a dot or checkmark, sized to match the text rather than a full icon box.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
partsRecord<string, HTMLElement | HTMLElement[] | null>Its elements by part name, for your own animation; a repeated part is an array.

Motion New

Tag: its appearance and press states.

<Tag
  :motion="{ states: { focus: { root: { scale: 1.04 } } } }"
/>
NameTypeDescription
initialexitrootSets 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.
statesfocusactivehoverSets 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) => animationAnimates 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 | stringTimes all of it: a spring, or a duration in ms with an easing. Never both.
falsebooleanTurns its motion off, for an animation of your own on its exposed elements.

Accessibility

It has no keyboard interaction of its own.

  • Tag is a <span> with no role and no keyboard handling.
  • The #icon slot is aria-hidden, so keep the meaning in the label.
  • A @click or tabindex you add gives it the press look only. Use a Button for actions.