shadcn.io is not affiliated with official shadcn/ui
Tag Creation Onboarding Block for React
A setup panel with a tags input that starts with five tags, refuses a repeat or a thirteenth in words, offers three suggestions as buttons and has Clear all with an Undo.
Installation
Overview
Let a new user make the tags their library will use, with this tags step for React with Base UI. It is a setup panel of Labelmoor, an asset library, ruled by Guides in bands. The first band is the catalog Tags Input with five tags and “5 of 12” beside its label: Enter or a comma adds a tag, Backspace takes the last one back and a double click renames one. A tag that is already there, whatever its capitals, and a thirteenth tag are refused in words under the field. Clear all empties it and Undo puts the same tags back. A band of suggestions shows three tags from a typed pool that are not there yet, each a button that adds it and returns focus to the field. Save tags is the one Shine Button, quiet until something changed, with Discard beside it.
FAQ
Which rules does the field apply?
A tag is trimmed, its inner spaces are kept to one and it keeps the capitals it was typed with, up to 24 characters. A tag is refused if it matches one already there ignoring case (“design” is refused while “Design” exists) and when 12 are there. The refusal is in the line under the field and in the status, and the typed text stays so it can be fixed. MAX, MAX_LENGTH and clean are at the top of the file.
How do the suggestions work?
POOL is the ordered list of suggestions; the three shown are the first three that are not tags yet, so each one added is replaced by the next, and when the pool is used up the band says so. Each is a real button named “Add” and the tag; pressing it adds the tag, says so in the status and puts focus back in the field so typing can go on.
What do Clear all and Undo do?
Clear all keeps the tags it removed. Undo, which is always on the screen but quiet while there is nothing to undo, puts exactly those tags back. Any other change (adding, removing, renaming) drops what Undo holds, so it can never bring back a stale list.
How does it work with the keyboard?
Type and press Enter or a comma to add. Backspace on an empty field picks the last tag and a second Backspace removes it; the arrow keys move between tags and Enter on one edits it. Save tags, Discard, Undo and Clear all stay in the tab order and answer in words when there is nothing for them to do.
What stays local in the demo, and how do I wire it?
Everything: tags live in the tab and Save tags only says they were kept in this demo. In your app save the list on your server where submit says so, check the repeat on the server as well (the field only checks what is on the screen) and replace POOL with the tags your customers use most.
Related
- Pro
Tag Input Form
Text fieldsA tags field that cleans every tag it takes (trimmed, lower case, no repeats), splits a pasted list and shows what was pasted next to what was added.
- Pro
A setup panel with a tree of categories beside a drawn sidebar that mirrors it live, with rename, add, move up, move down, delete and undo for the picked category.
- Pro
A setup panel that turns a pasted spreadsheet header into typed fields, with a list of eight places and a live New customer record that shows the right control for each type.
- Pro
A setup panel with three sample sets as radio rows beside the picked set's first five rows and counts, a Load sample data button and a Remove that takes the samples out again.
- Pro
A project step split in two: a name with the key its tasks will carry and a three-way choice of how to start, beside a drawn board that follows the choice.
- Pro
Industry Picker Onboarding
Several choicesA multi combobox with chips over eighteen industries that holds three, says the limit in words and refuses a fourth instead of switching anything off, with an Add row for a name that is not on the list.