Token @astryx-svelte/core v0.3.0 · Token

Usage

Token is a small, inline element for representing discrete pieces of associated data, like tags, categories, or selections. Use it to label content, show active filters, or represent removable items like selected recipients in a compose field.
ts
import { Token } from '@astryx-svelte/core';

Best practices

GuidancePractices
DoUse color to distinguish categories (for example, green for "Active", red for "Blocked", blue for "In Review") so users can scan status at a glance.
DoProvide an onRemove callback when tokens represent user selections that can be undone, like filters or multi-select values.
DoAdd a leading icon when it helps identify the token type faster, like a person icon for user tokens or a tag icon for labels.
DoKeep labels short: one to three words. Tokens truncate with ellipsis when the text overflows.
Don'tDon't use tokens for primary actions or navigation; use Button or Link instead. Tokens are for displaying metadata, not triggering workflows.
Don'tDon't hide the label unless the icon alone is universally understood. A color dot without text is ambiguous.
Don'tDon't mix too many colors in one token group. Stick to two or three meaningful colors so the palette stays scannable.

Examples

Common configurations, variations, and states.
Token — Clickable
Interactive tokens that respond to clicks. Use for toggleable filters or tokens that open a detail view when selected.
Token — Colors
All 11 color variants in default and disabled states. Use color to categorize entities or convey status at a glance.
Token — End Content
Tokens with trailing content like a count badge or status indicator after the label. Use for notification counts, item quantities, or compact status info.
Token — Icon
Tokens with a leading icon that identifies the entity type. Use when the icon helps users recognize the token category faster, like a user icon for people or a tag icon for labels.
Token — Removable
Tokens with a dismiss button for selections the user can undo. Use in multi-select fields, active filters, or any list of user-chosen items.