ChipInput
A field that turns each entry into a chip when Enter is pressed, each with a remove button.
Stability: experimental
Props
| Prop | Type | Default | Means |
|---|---|---|---|
label | string | The label above the field, and its accessible name. | |
values | string[] | bindable([]) | The entries, in order; an entry already there is not added again. Bind it with bind:values={name}. |
placeholder | string | Add and press Enter | Hint text while the field is empty. |
States
| State | Looks like |
|---|---|
default | A bordered box of chips with the field after them. |
Accessibility
| role | none; a text field and a button per chip |
| name | The label prop names the field; each remove button says which entry it removes. |
| focus | Tab reaches each remove button, then the field. |
| keyboard | Enter adds what was typed; Enter and Space on a remove button remove its entry. |
Theme tokens
color.border color.surface color.raised color.ink color.muted radius.full space.1 space.2 space.3 text.label text.caption text.body
Example
<ChipInput label="Tags" bind:values={tags} />