Skip to content
Back

Tag Input

Several values in one field as chips: paste a whole list, a check per value, duplicates flash, Backspace and arrows to edit.

oxyn add tag-input
MCP
researchq4agents
Enter or comma adds; paste a list
3/8
Dioxus
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: Some(8),
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Several short values in one field: invitees, labels, allowed domains, the files and people an agent should look at.
  • The user types or pastes a list and wants each value checked and kept as a removable chip without losing what they typed.

When not to use

  • Pick one or many from a searchable, grouped list: use Combobox instead.
  • One input for every form: use Text Field instead.
  • A small status label that carries the colour: use Badge instead.

Installation

Tag Input is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add tag-input
Rust
use crate::oxyn::{TagInput, PRIMITIVES_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{TagInput, PRIMITIVES_CSS};

Usage

Dioxus · rust
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: Some(8),
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Examples

Labels

Short labels with a counter.

researchq4agents
Enter or comma adds; paste a list
3/8
Code
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: Some(8),
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

People

Emails with initials, lowercased and checked.

sam@acme.devari@acme.dev
Paste a list of emails
Code
rsx! {
    TagInput {
        label: "Invite",
        value: tags(),
        hint: "Paste a list of emails",
        max: None,
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Typed context

Person, file, tool and label chips (Oxyn plus).

@mayasrc/auth.rstool:search#bug
Enter or comma adds; paste a list
Code
rsx! {
    TagInput {
        label: "Context",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: None,
        typed: true,
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Suggestions

Agent suggestions as you type (Oxyn plus).

researchq4agents
Type “re”
3/8
Code
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Type “re”",
        max: Some(8),
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Folded

Folds past three into +N (Oxyn plus).

researchq4+1
Enter or comma adds; paste a list
3/8
Code
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: Some(8),
        fold: Some(2),
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

Error

Invalid from outside.

researchq4agents
Add at least one owner
3/8
Code
rsx! {
    TagInput {
        label: "Labels",
        value: tags(),
        hint: "Enter or comma adds; paste a list",
        max: Some(8),
        fold: None,
        on_change: move |t: Vec<String>| tags.set(t),
    }
}

API reference

TagInput

PropTypeDefaultDescription
labelrequiredString—Label.
valueVec<String>Default::default()Starting chips.
placeholderString"Add…"Placeholder while empty (`Add more…` after the first chip).
hintOption<String>Default::default()Hint (a message takes its place while there is one).
errorOption<String>Default::default()Error from the app.
optionalboolDefault::default()"Optional" next to the label.
validateString"any"Check: `any` · `email` · `domain` · `max:24`.
normalizeString"trim"Clean: `trim` · `lower` · `slug`.
split_on_spaceboolDefault::default()Also split on spaces.
maxOption<usize>Default::default()Max chips (shows `3/10`).
avatarboolDefault::default()Initials circle on every chip (people).
typedboolDefault::default()Oxyn plus: icon per chip kind (person, file, tool, label).
suggestionsVec<String>Default::default()Oxyn plus: suggestions offered as you type.
foldOption<usize>Default::default()Oxyn plus: fold chips past this count into `+N`.
nameOption<String>Default::default()Form field name (one hidden input per chip).
disabledboolDefault::default()Disabled.
on_changeEventHandler<Vec<String>>—Changed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
Enteror,Turn what you typed into a chip (Tab does too, then moves on)
SpaceAlso adds, with split_on_space
⌫On an empty field: first press marks the last chip, the second removes it
←or→Walk the chips; Backspace or Delete removes the one in focus
Enter on a chipMoves it back into the field to edit (Oxyn plus)
EscClears the pick, then what you were typing

Accessibility

  • A real text input with a label; chips sit before it, each with a labelled Remove button.
  • Adds, removals, duplicates and limits are announced in a polite live region.
  • A message sets aria-invalid and is linked with aria-describedby.
  • Chips are reached with ← from the start of the field, so Tab moves straight on.
From the spec

A real labelled input; chips are spans with a labelled "Remove {value}" button (tabindex=-1; the keyboard reaches chips with ←). Adds, removals, duplicates and limits go to a polite live region ("Added sam@acme.dev, 2 of 8"). Messages set aria-invalid and are linked with aria-describedby. Chip contrast meets 4.5:1 on surface.hover.

Motion & interaction

New chips grow in from 86 % with a short blur; removed chips leave and their neighbours close the gap. A duplicate flashes the chip it repeats. Pasting a list adds each value in turn. The counter and +N roll. Typed chips (Oxyn plus) carry a person, file, tool or label icon.

Timing
TransitionDurationEasingReduced motion
Chip in160 ms, scale .86 → 1, blur 3 → 0ease.out1 ms
Duplicate flash600 msease.outnone
Counter / +N roll200 msease.outswap
Message in180 ms riseease.outswap

Responsive behaviour

  • Chips wrap; after about five lines the field scrolls inside.
  • Long values end in … with the full text on hover.
  • Touch: taller chips, a bigger × and 16 px input text (no iOS zoom).
Edge cases (spec)

Long values end in … at 14 rem with the full text in title. A pasted list keeps rejected parts in the field so nothing is lost. Space only splits with split_on_space. Very long lists scroll inside the field after ~5 lines. Normalisation (trim / lower / slug) happens before the duplicate check. RTL: chips flow from the right, ← / → follow visual order. Touch: 24 px × targets, 16 px input text (no iOS zoom).

Notes for AI

  • Import TagInput from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: TagInputEl in oxyn_gpui.
  • Props to set first: label.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI