Tag chip
A label the user wrote: a grey rectangle at the chip radius, an optional mark, and a remove button with a 24px hit area.
Read only With an icon Onboarding Invoices A label long enough to truncate inside its chip
Installation
pnpm add @heyramzi/uiUsage
import { TagChip } from "@heyramzi/ui/components/chip";Keyboard and accessibility
| Key | Does |
|---|---|
| Space Enter | On the remove button, removes the tag. |
- The remove button is named by removeLabel. Name the tag in it, like "Remove design".
API reference
iconSnippet- A leading mark: a tag icon, a colour dot, an avatar.
onRemove() => void- Shows a remove button after the label.
removeLabelstring- Default
"Remove" - The remove button's accessible name.
removeFocusableboolean- Default
true - False keeps the remove button out of the tab order and stops it taking focus on press, for a chip inside a field whose input owns the keyboard (Backspace removes).
childrenSnippetclassstring...rest- Every prop of
HTMLAttributes<HTMLSpanElement>fromsvelte/elementsexceptchildren, class
| Prop | Type | Default |
|---|---|---|
icon A leading mark: a tag icon, a colour dot, an avatar. | Snippet | |
onRemove Shows a remove button after the label. | () => void | |
removeLabel The remove button's accessible name. | string | "Remove" |
removeFocusable False keeps the remove button out of the tab order and stops it taking focus on press, for a chip inside a field whose input owns the keyboard (Backspace removes). | boolean | true |
children | Snippet | |
class | string | |
...rest | Every prop of HTMLAttributes<HTMLSpanElement> from svelte/elements except children, class | |