StealThis .dev

Tag Input

Multi-value tag input — type and press Enter or comma to add tags, click ✕ to remove. Keyboard navigation supported.

Open in Lab
css vanilla-js
Targets: JS HTML

Code

Tag Input

Multi-value tag field. Type text and press Enter or , to create a tag. Click the × button or focus a tag and press Backspace / Delete to remove it.

Keyboard shortcuts

KeyAction
Enter / ,Confirm and add tag
Backspace (empty field)Remove last tag
Backspace / Delete (on tag)Remove focused tag
TabMove focus to next tag or input

Implementation

Tags are rendered as <span> elements inside a <div> that looks like an input field. The real text input sits at the end and grows with content. A hidden <input> mirrors the comma-joined value for form submission.