Input

Input is a component used to obtain text input from the user.

Usage

import { Input, InputGroup } from "@yamada-ui/react"
<Input />
<InputGroup.Root>
  <InputGroup.Addon />
  <Input />
  <InputGroup.Element />
</InputGroup.Root>

Change Variant

Change Size

Change Color Scheme

Disable

To disable the input, set disabled to true.

Read-Only

To read-only, set readOnly to true.

Invalid

To make invalid, set invalid to true.

Add Addons

To add addons, wrap the Input in InputGroup and use InputGroup.Addon.

https://
.com
https://
.com
https://
.com

Add Elements

To add elements, wrap the Input in InputGroup and use InputGroup.Element.

Change Type

To change the type, set type to the type.

Change Border Color

To change the border color, set focusBorderColor or errorBorderColor to the color.

Change Placeholder Color

To change the placeholder color, set _placeholder to the value.

Floating Label

Control

Props

Accessibility

If you are not using Field.Root, set aria-label or aria-labelledby to Input.

<Input type="email" aria-label="Email address" />
<VStack gap="sm">
  <Text as="h3" id="label">
    Email address
  </Text>

  <Input type="email" aria-labelledby="label" />
</VStack>

ARIA Roles and Attributes

ComponentRoles and AttributesUsage
Inputaria-invalidSets to "true" if invalid is set.
aria-disabledSets to "true" if disabled is set.
aria-describedbyIf Input is within a Field.Root and Field.Root has an errorMessage, helperMessage, or a Field.ErrorMessage, Field.HelperMessage, sets its id.
aria-readonlySets to "true" if readOnly is set.
aria-requiredSets to "true" if required is set.

Similar Components

Editable

Editable is a component used to obtain inline editable text input.

NumberInput

NumberInput is a component used to obtain numeric input from the user.

PasswordInput

PasswordInput is a component that allows users to input passwords with a visibility toggle.

PinInput

PinInput is a component used to capture pin codes or OTP (One-Time Password) inputs.

Textarea

Textarea is a component used to obtain multi-line text input.

FileInput

FileInput is a component used for users to select files.

Autocomplete

Autocomplete is a component used to display suggestions in response to user text input.

Checkbox

Checkbox is a component used for allowing users to select multiple values from multiple options.

Uses Components & Hooks

Used By Components & Hooks

Autocomplete

Autocomplete is a component used to display suggestions in response to user text input.

Checkbox

Checkbox is a component used for allowing users to select multiple values from multiple options.

CheckboxCard

CheckboxCard is a component used for allowing users to select multiple values from multiple options.

ColorPicker

ColorPicker is a component used by the user to select a color or enter an arbitrary color value.

DatePicker

DatePicker is a component used for users to select a date.

Dropzone

Dropzone is a component used for uploading files via drag and drop.

Editable

Editable is a component used to obtain inline editable text input.

FileButton

FileButton is a button component used for users to select files.

FileInput

FileInput is a component used for users to select files.

NativeSelect

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

NumberInput is a component used to obtain numeric input from the user.

PasswordInput

PasswordInput is a component that allows users to input passwords with a visibility toggle.

PinInput

PinInput is a component used to capture pin codes or OTP (One-Time Password) inputs.

Radio

Radio is a component used for allowing users to select one option from multiple choices.

RadioCard

RadioCard is a component used for allowing users to select one option from multiple choices.

Select

Select is a component used for allowing a user to choose values from a list of options.

Textarea

Textarea is a component used to obtain multi-line text input.

Toggle

Toggle is a component that has two states: on or off.