Input
A single line field with clear labels and useful states.
npx shadcn@latest add @silicon-ui/inputInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/inputManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/input/input.tsx
- components/silicon-ui/input/input.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
label* | string | — |
prefixFixed text or an icon inside the field before what is typed (a currency, "c:"). It takes the typed text's size and a quieter colour, with no gap: the value reads as one word with it. | ReactNode | — |
suffixAn icon or short text inside the field after what is typed (a status icon, a unit). | ReactNode | — |
descriptionPlain text animates word by word when it changes; markup (a bold id) is shown as given. | ReactNode | — |
error | string | — |
Also accepts the props of InputHTMLAttributes<HTMLInputElement>, except prefix.
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens