Color Schemes for Input are not implemented in the default theme. You can extend the theme to implement them.
Input
Input component is a component that is used to get user input in a text field.
Props#
The Input component composes Box so you can
pass all Box props, and React.InputHTMLAttributes.
colorScheme
colorSchemestringerrorBorderColor
errorBorderColorThe border color when the input is invalid. Use color keys in `theme.colors` @example errorBorderColor = "red.500"
stringfocusBorderColor
focusBorderColorThe border color when the input is focused. Use color keys in `theme.colors` @example focusBorderColor = "blue.500"
stringhtmlSize
htmlSizeThe native HTML size attribute to be passed to the input
numberisDisabled
isDisabledIf true, the form control will be disabled. This has 2 side effects:
- The FormLabel will have `data-disabled` attribute
- The form element (e.g, Input) will be disabled
booleanisInvalid
isInvalidIf true, the form control will be invalid. This has 2 side effects:
- The FormLabel and FormErrorIcon will have `data-invalid` set to true
- The form element (e.g, Input) will have `aria-invalid` set to true
booleanisReadOnly
isReadOnlyIf true, the form control will be readonly
booleanisRequired
isRequiredIf true, the form control will be required. This has 2 side effects:
- The FormLabel will show a required indicator
- The form element (e.g, Input) will have `aria-required` set to true
booleansize
size"lg" | "md" | "sm" | "xs""md"variant
variant"outline" | "filled" | "flushed" | "unstyled""outline"Props#
The Input component composes Box so you can
pass all Box props, and React.InputHTMLAttributes.
colorScheme
colorSchemeColor Schemes for Input are not implemented in the default theme. You can extend the theme to implement them.
stringerrorBorderColor
errorBorderColorThe border color when the input is invalid. Use color keys in `theme.colors` @example errorBorderColor = "red.500"
stringfocusBorderColor
focusBorderColorThe border color when the input is focused. Use color keys in `theme.colors` @example focusBorderColor = "blue.500"
stringhtmlSize
htmlSizeThe native HTML size attribute to be passed to the input
numberisDisabled
isDisabledIf true, the form control will be disabled. This has 2 side effects:
- The FormLabel will have `data-disabled` attribute
- The form element (e.g, Input) will be disabled
booleanisInvalid
isInvalidIf true, the form control will be invalid. This has 2 side effects:
- The FormLabel and FormErrorIcon will have `data-invalid` set to true
- The form element (e.g, Input) will have `aria-invalid` set to true
booleanisReadOnly
isReadOnlyIf true, the form control will be readonly
booleanisRequired
isRequiredIf true, the form control will be required. This has 2 side effects:
- The FormLabel will show a required indicator
- The form element (e.g, Input) will have `aria-required` set to true
booleansize
size"lg" | "md" | "sm" | "xs""md"variant
variant"outline" | "filled" | "flushed" | "unstyled""outline"The Input component is a multipart component. Read more about how to style multipart components in the style system docs.
This component has three parts: field, addon, and element. You can find
more information in the source for the styles
here.
Example#
The following theme would add a background with the value red.200 to the
field, and remove the border of the addon.
import { extendTheme } from '@chakra-ui/react'const theme = extendTheme({components: {Input: {baseStyle: {field: {bg: 'red.200',},addon: {border: 'none',},},},},})