---
title: Input
description: "`Input` is a component used to obtain text input from the user."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/input/input.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/input
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-input--basic
---
# Input
`Input` is a component used to obtain text input from the user.
```tsx
```
## Usage
```tsx
import { Input, InputGroup } from "@yamada-ui/react"
```
```tsx
import { Input, InputGroup } from "@/components/ui"
```
```tsx
import { Input, InputGroup } from "@workspaces/ui"
```
```tsx
```
```tsx
```
### Change Variant
```tsx
{(variant) => (
)}
```
### Change Size
```tsx preview
{(size) => }
```
### Change Color Scheme
```tsx
{(colorScheme) => (
)}
```
### Disable
To disable the input, set `disabled` to `true`.
```tsx
{(variant) => (
)}
```
### Read-Only
To read-only, set `readOnly` to `true`.
```tsx
{(variant) => (
)}
```
### Invalid
To make invalid, set `invalid` to `true`.
```tsx
{(variant) => (
)}
```
### Add Addons
To add addons, wrap the `Input` in `InputGroup` and use `InputGroup.Addon`.
```tsx
{(variant) => (
https://.com
)}
```
### Add Elements
To add elements, wrap the `Input` in `InputGroup` and use `InputGroup.Element`.
```tsx
{(variant) => (
)}
```
### Change Type
To change the type, set `type` to the [type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types).
```tsx
```
### Change Border Color
To change the border color, set `focusBorderColor` or `errorBorderColor` to the color.
```tsx
```
### Change Placeholder Color
To change the placeholder color, set `_placeholder` to the value.
```tsx
```
### Floating Label
```tsx
Email
```
### Control
```tsx
const [value, setValue] = useState("オッス!オラ悟空!")
return setValue(ev.target.value)} />
```
## Props
### Input
| Prop | Default | Type | Description |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"outline"` | `"filled" \| "flushed" \| "outline" \| "plain"` | The variant of the component. |
| `errorBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is focused. |
| `htmlSize` | - | `number` | The native HTML `size` attribute to be passed to the `input`. |
| `invalid` | `false` | `boolean` | If `true`, the field will be invalid. |
### InputGroup.Root
| Prop | Default | Type | Description |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"outline"` | `"filled" \| "flushed" \| "outline" \| "plain"` | The variant of the component. |
| `align` | - | `"-moz-initial" \| "anchor-center" \| "baseline" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "normal" ...` | The CSS `align-items` property. |
| `basis` | - | `"-moz-fit-content" \| "-moz-initial" \| "-moz-max-content" \| "-moz-min-content" \| "-webkit-auto" \| "0.5" \| "1.5" \| "1" \| "1/12" \| "1/2" ...` | The CSS `flex-basis` property. |
| `direction` | - | `"-moz-initial" \| "column-reverse" \| "column" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "row-reverse" \| "row" \| "unset" ...` | The CSS `flex-direction` property. |
| `disabled` | `false` | `boolean` | If `true`, the field will be disabled. |
| `errorBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is focused. |
| `invalid` | `false` | `boolean` | If `true`, the field will be invalid. |
| `justify` | - | `"-moz-initial" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "left" \| "normal" \| "revert-layer" ...` | The CSS `justify-content` property. |
| `readOnly` | `false` | `boolean` | If `true`, the field will be readonly. |
| `required` | `false` | `boolean` | If `true`, the field will be required. |
| `shrink` | - | `"-moz-initial" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "unset" \| AnyString \| number & {} ...` | The CSS `flex-shrink` property. |
| `wrap` | - | `"-moz-initial" \| "inherit" \| "initial" \| "nowrap" \| "revert-layer" \| "revert" \| "unset" \| "wrap-reverse" \| "wrap" \| AnyString ...` | The CSS `flex-wrap` property. |
### InputGroup.Addon
| Prop | Default | Type | Description |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"outline"` | `"filled" \| "flushed" \| "outline" \| "plain"` | The variant of the component. |
| `errorBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is focused. |
### InputGroup.Element
| Prop | Default | Type | Description |
| ------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `errorBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is focused. |
## Accessibility
If you are not using `Field.Root`, set `aria-label` or `aria-labelledby` to `Input`.
```tsx
```
```tsx
Email address
```
### ARIA Roles and Attributes
| Element | Roles and Attributes | Usage |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `input.ui-input` | `aria-invalid` | Sets to `"true"` if `invalid` is set. |
| | `aria-disabled` | Sets to `"true"` if `disabled` is set. |
| | `aria-describedby` | If `Input` is within a `Field.Root` and `Field.Root` has an `errorMessage`, `helperMessage`, or a `Field.ErrorMessage`, `Field.HelperMessage`, sets its `id`. |
| | `aria-readonly` | Sets to `"true"` if `readOnly` is set. |
| | `aria-required` | Sets to `"true"` if `required` is set. |
## Similar Components
- [Editable](https://yamada-ui.com/docs/components/editable.md): `Editable` is a component used to obtain inline editable text input.
- [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user.
- [PasswordInput](https://yamada-ui.com/docs/components/password-input.md): `PasswordInput` is a component that allows users to input passwords with a visibility toggle.
- [PinInput](https://yamada-ui.com/docs/components/pin-input.md): `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs.
- [Textarea](https://yamada-ui.com/docs/components/textarea.md): `Textarea` is a component used to obtain multi-line text input.
- [FileInput](https://yamada-ui.com/docs/components/file-input.md): `FileInput` is a component used for users to select files.
- [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md): `Autocomplete` is a component used to display suggestions in response to user text input.
- [Checkbox](https://yamada-ui.com/docs/components/checkbox.md): `Checkbox` is a component used for allowing users to select multiple values from multiple options.
## Uses Components & Hooks
- [Field](https://yamada-ui.com/docs/components/field.md): `Field` is a component used to group form elements with label, helper message, error message, etc.
- [Group](https://yamada-ui.com/docs/components/group.md): `Group` is a component that groups and attaches multiple elements together.
## Used By Components & Hooks
- [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md): `Autocomplete` is a component used to display suggestions in response to user text input.
- [Checkbox](https://yamada-ui.com/docs/components/checkbox.md): `Checkbox` is a component used for allowing users to select multiple values from multiple options.
- [CheckboxCard](https://yamada-ui.com/docs/components/checkbox-card.md): `CheckboxCard` is a component used for allowing users to select multiple values from multiple options.
- [ColorPicker](https://yamada-ui.com/docs/components/color-picker.md): `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value.
- [DatePicker](https://yamada-ui.com/docs/components/date-picker.md): `DatePicker` is a component used for users to select a date.
- [Dropzone](https://yamada-ui.com/docs/components/dropzone.md): `Dropzone` is a component used for uploading files via drag and drop.
- [Editable](https://yamada-ui.com/docs/components/editable.md): `Editable` is a component used to obtain inline editable text input.
- [FileButton](https://yamada-ui.com/docs/components/file-button.md): `FileButton` is a button component used for users to select files.
- [FileInput](https://yamada-ui.com/docs/components/file-input.md): `FileInput` is a component used for users to select files.
- [NativeSelect](https://yamada-ui.com/docs/components/native-select.md): `NativeSelect` is a component used for allowing users to select one value from a list of options. It displays a native dropdown list provided by the browser (user agent).
- [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user.
- [PasswordInput](https://yamada-ui.com/docs/components/password-input.md): `PasswordInput` is a component that allows users to input passwords with a visibility toggle.
- [PinInput](https://yamada-ui.com/docs/components/pin-input.md): `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs.
- [Radio](https://yamada-ui.com/docs/components/radio.md): `Radio` is a component used for allowing users to select one option from multiple choices.
- [RadioCard](https://yamada-ui.com/docs/components/radio-card.md): `RadioCard` is a component used for allowing users to select one option from multiple choices.
- [Select](https://yamada-ui.com/docs/components/select.md): `Select` is a component used for allowing a user to choose values from a list of options.
- [Textarea](https://yamada-ui.com/docs/components/textarea.md): `Textarea` is a component used to obtain multi-line text input.
- [Toggle](https://yamada-ui.com/docs/components/toggle.md): `Toggle` is a component that has two states: on or off.