Input

Used to get user input in a text field.

Usage

import { Input } from "chakra-ui-solid";
<Input />

Examples

Variants

Use the variant prop to change the visual style of the input.

Sizes

Use the size prop to change the size of the input.

Helper Text

Pair the input with the Field component to add helper text.

We'll never share your email.

Error Text

Pair the input with the Field component to add error text.

This field is required

Field

Compose the input with the Field component to add a label, helper text, and error text.

Element

Use the startElement and endElement on the InputGroup component to add an element to the start and end of the input.

Start Icon

Start Text

https://

Start and End Text

$
USD

Kbd

⌘K

Select

https://

Addon

Use the InputAddon and Group components to add an addon to the input.

Start Addon

https://

End Addon

.com

Start and End Addon

$
USD

Disabled

Use the disabled prop to disable the input.

Button

Use the Group component to attach a button to the input.

Focus and Error Color

Use the --focus-color and --error-color CSS custom properties to change the color of the input when it is focused or in an error state.

Placeholder Style

Use the _placeholder prop to style the placeholder text.

Floating Label

Here’s an example of how to build a floating label to the input.

Character Counter

Here’s an example of how to add a character counter to the input.

0 / 20

Clear Button

Combine the Input and CloseButton components to create a clear button. This is useful for building search inputs.

Props

InputProps
PropDefaultType
size'md'
ConditionalValue<'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | PresetVariant<'input', 'size'>>

The height, horizontal padding and text style together. The height is published as `--input-height`, so anything positioned against the field can read it back.

variant'outline'
ConditionalValue<'outline' | 'subtle' | 'flushed' | PresetVariant<'input', 'variant'>>

How the field is drawn — `outline` is a full border, `subtle` fills it instead, and `flushed` keeps only the bottom edge with no radius or horizontal padding.

Plus HTMLChakraProps<"input"> — the whole style-prop surface and the DOM attributes of the element it renders, several hundred names listed as their sources rather than expanded — and the three every component takes: as, render and unstyled.