Input

A text field at the button's four heights, filled or outlined, that a Field labels, describes and marks invalid without being told.

01Preview

01
Full screen

Only used to send receipts.

02Installation

npx shadcn@latest add https://aiellie.app/r/input.json

03API reference

01
From the Base UI documentation

A native input element that automatically works with [Field](https://base-ui.com/react/components/field). Renders an <input> element.

Props

PropTypeDefaultDescription
defaultValuestring | number | string[]-The default value of the input. Use when uncontrolled.
valuestring | string[] | number-The value of the input. Use when controlled.
onValueChange((value: string, eventDetails: Input.ChangeEventDetails) => void)-Callback fired when the value changes. Use when controlled.
classNamestring | ((state: Input.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component's state.
styleReact.CSSProperties | ((state: Input.State) => React.CSSProperties | undefined)-Style applied to the element, or a function that returns a style object based on the component's state.
renderReactElement | ((props: HTMLProps, state: Input.State) => ReactElement)-Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Data Attributes

AttributeTypeDescription
data-disabled-Present when the input is disabled.
data-valid-Present when the input is in a valid state (when wrapped in Field.Root).
data-invalid-Present when the input is in an invalid state (when wrapped in Field.Root).
data-dirty-Present when the input's value has changed (when wrapped in Field.Root).
data-touched-Present when the input has been touched (when wrapped in Field.Root).
data-filled-Present when the input is filled (when wrapped in Field.Root).
data-focused-Present when the input is focused (when wrapped in Field.Root).