Tag Input
formcn/tag-inputFreeComponent
Tag input component
Install it
npx shadcn@latest add https://formcn.dev/r/tag-input.jsonSource
1import {2 TagInput as EmblorTagInput,3 type Tag,4 type TagInputProps,5} from 'emblor'6import { type Dispatch, type SetStateAction, useState } from 'react'78type TagInputWrapperProps = {9 tags?: Tag[]10 setTags: Dispatch<SetStateAction<Tag[]>>11} & Omit<12 TagInputProps,13 'activeTagIndex' | 'setActiveTagIndex' | 'tags' | 'setTags'14>1516export function TagInput({17 tags,18 setTags,19 name,20 ...rest21}: TagInputWrapperProps) {22 const [activeTagIndex, setActiveTagIndex] = useState<number | null>(null)2324 return (25 <EmblorTagInput26 id={name}27 styleClasses={{28 inlineTagsContainer:29 'border-input rounded-md dark:bg-input/30 shadow-xs transition-[color,box-shadow] focus-within:border-ring outline-none focus-within:ring-[3px] focus-within:ring-ring/50 p-1 gap-1.5',30 input: 'w-full min-w-[80px] shadow-none px-2 h-7',31 tag: {32 body: 'h-7 relative bg-input/60 border border-input hover:bg-secondary rounded-md font-medium text-xs ps-2 pe-7',33 closeButton:34 'absolute -inset-y-px -end-px p-0 rounded-e-md flex size-7 transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] text-muted-foreground/80 hover:text-foreground',35 },36 }}37 tags={tags ?? []}38 setTags={setTags}39 {...rest}40 activeTagIndex={activeTagIndex}41 setActiveTagIndex={setActiveTagIndex}42 animation="fadeIn"43 truncate={15}44 />45 )46}
What it pulls in
npm packages
Files it writes
More from formcn
All 9 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| File Inputfile-upload | formcn | Components | Free | no deps | |
| Multi-selectmulti-select | formcn | Components | Free | no deps | |
| Multi-step formmulti-step-viewer | formcn | Components | Free | 1 dep | |
| Passwordpassword | formcn | Components | Free | no deps | |
| Ratingrating | formcn | Components | Free | no deps | |
| Stepperstepper | formcn | Components | Free | no deps |
