Tag
Chips for labels and filters — closable, checkable, and groupable.
Astralisv0.1DesignEngineeringResearch
"use client";
import { useState } from "react";
import { Tag, HStack } from "astralis-ui";
export function TagDemo() {
const [tags, setTags] = useState(["Design", "Engineering", "Research"]);
return (
<HStack gap="2" wrap="wrap" justifyContent="center">
<Tag colorScheme="purple">Astralis</Tag>
<Tag variant="outline" colorScheme="blue">v0.1</Tag>
{tags.map((tag) => (
<Tag key={tag} closable onClose={() => setTags(tags.filter((t) => t !== tag))}>
{tag}
</Tag>
))}
</HStack>
);
}Import#
import { Tag } from "astralis-ui";
// Tag.Checkable, Tag.GroupCheckable groups#
Tag.Checkable is a chip with checkbox semantics; Tag.Group manages a
whole set from an options array — multiple for filters, single-select
for exclusive choices.
ReactVueSvelteSolid
Following: react
"use client";
import { useState } from "react";
import { Tag, Text, VStack } from "astralis-ui";
export function TagCheckable() {
const [topics, setTopics] = useState<Array<string | number>>(["react"]);
return (
<VStack gap="3" alignItems="center">
<Tag.Group
multiple
value={topics}
onChange={setTopics}
options={[
{ label: "React", value: "react" },
{ label: "Vue", value: "vue" },
{ label: "Svelte", value: "svelte" },
{ label: "Solid", value: "solid" },
]}
/>
<Text size="xs" color="muted">
Following: {topics.length ? topics.join(", ") : "nothing yet"}
</Text>
</VStack>
);
}Props#
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "solid" | "subtle" | "surface" | "outline" | "subtle" | Same family as Button/Badge. |
size | "xs" | "sm" | "md" | "lg" | "md" | Chip size (same scale as Badge). |
colorScheme | all 11 schemes | "gray" | Hue. |
startElement / endElement | ReactNode | — | Leading / trailing slots (endElement yields to the close button). |
closable / onClose | boolean / () => void | — | Adds the ✕ remove button. |
Tag.Group#
| Prop | Type | Default | Description |
|---|---|---|---|
options | { label, value }[] or primitives | — | The chips to render. |
value / onChange | (string | number)[] / (value) => void | [] | Controlled selection. |
multiple | boolean | false | Multi-select vs exclusive. |
Accessibility#
Checkable tags carry role="checkbox" + aria-checked and toggle with
Enter/Space; the close button is labeled "Remove".