Components
Tag Input
A field of removable tags: Enter or comma adds one, Backspace removes the last.
Ombelle · light
Tag Input
- design-tokens
- glass
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add tag-inputAdds components/ui/tag-input.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { TagInput, TagInputList, TagInputInput } from '@/components/ui/tag-input'
export function Example(){return <div style={{ display: "grid", gap: "0.5rem" }}><label id="topics-label">Topics</label><TagInput defaultValue={['design-tokens', 'glass']} name="topics"><TagInputList /><TagInputInput aria-labelledby="topics-label" placeholder="Add a topic" /></TagInput></div>}API and states
- API
- TagInput (value, defaultValue, separators, max, allowDuplicates, name), TagInputList, TagInputInput
- Minimum states
- Empty, tags, duplicate, at maximum, disabled, focus within
- Native basis
- Native input and list with a polite live region
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.