export const title = "Input field"
export const description = "Free and open-source React input field components built for modern applications and websites. These input fields are built using React Aria and styled with Tailwind CSS."
export const links = {
github: "https://github.com/untitleduico/react/tree/main/components/base/input",
rac: "https://react-spectrum.adobe.com/react-aria/Input.html"
}
import * as Demos from "@/components/base/input/inputs.demo.tsx";
## Installation
You can add this input component using our CLI or manually:
```bash
npx untitledui@latest add input
```
Copy the files below into your project:
Great! Now you can start using the input field components in your project by just copy/pasting our examples below.
## Input examples
Below are examples and variations of this input component:
### Default {{ tocOnly:true }}
### Disabled {{ tocOnly:true }}
### Invalid {{ tocOnly:true }}
### Sizes {{ tocOnly:true }}
### Leading icon {{ tocOnly:true }}
### Leading Dropdown {{ tocOnly:true }}
### Trailing dropdown {{ tocOnly:true }}
### Leading text {{ tocOnly:true }}
### Payment input {{ tocOnly:true }}
### Trailing button {{ tocOnly:true }}
### File upload {{ tocOnly:true }}
### Password input {{ tocOnly:true }}
### Date input {{ tocOnly:true }}
### Number input horizontal {{ tocOnly:true }}
### Number input vertical {{ tocOnly:true }}
### Tag input {{ tocOnly:true }}
### Tag input outer {{ tocOnly:true }}
## API reference
` as the addon, and use the `prefix` string prop for text shown inside the field, such as `$`. There is no `suffix` prop.",
},
{
question: "How do I use inputs in a form or as controlled fields?",
answer: "Give each `Input` a `name` so its value is included in the form data on submit. For controlled state pass `value` and `onChange`, which receives the new string directly rather than an event; use `defaultValue` for uncontrolled fields.",
},
{
question: "How do I add keyboard shortcuts to inputs?",
answer: "Pass a string to the `shortcut` prop to display custom text, or `true` to show the default `\"⌘K\"`. The badge is display only and hidden below the `md` breakpoint, so you still need to register the key handler that focuses the input yourself.",
},
]}
/>