# Input

A text input component for forms and user data entry with built-in styling and accessibility features.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).



<ComponentPreview name="input-demo" previewClassName="*:max-w-xs" />

## Installation [#installation]

<Tabs defaultValue="cli">
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add https://shadcn-cssinjs.com/r/input.json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource name="input" title="input.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>

## Usage [#usage]

```tsx
import { Input } from "@/components/ui/input";
```

```tsx
<Input />
```

## Basic [#basic]

<ComponentPreview name="input-basic" previewClassName="*:max-w-xs" />

## Field [#field]

Use `Field`, `FieldLabel`, and `FieldDescription` to create an input with a
label and description.

<ComponentPreview name="input-field" previewClassName="*:max-w-xs" />

## Field Group [#field-group]

Use `FieldGroup` to show multiple `Field` blocks and to build forms.

<ComponentPreview name="input-fieldgroup" previewClassName="*:max-w-xs" />

## Disabled [#disabled]

Use the `disabled` prop to disable the input. To style the disabled state, add the `data-disabled` attribute to the `Field` component.

<ComponentPreview name="input-disabled" previewClassName="*:max-w-xs" />

## Invalid [#invalid]

Use the `aria-invalid` prop to mark the input as invalid. To style the invalid state, add the `data-invalid` attribute to the `Field` component.

<ComponentPreview name="input-invalid" previewClassName="*:max-w-xs" />

## File [#file]

Use the `type="file"` prop to create a file input.

<ComponentPreview name="input-file" previewClassName="*:max-w-xs" />

## Inline [#inline]

Use `Field` with `orientation="horizontal"` to create an inline input.
Pair with `Button` to create a search input with a button.

<ComponentPreview name="input-inline" previewClassName="*:max-w-xs" />

## Grid [#grid]

Use a grid layout to place multiple inputs side by side.

<ComponentPreview name="input-grid" previewClassName="p-6" />

## Required [#required]

Use the `required` attribute to indicate required inputs.

<ComponentPreview name="input-required" previewClassName="*:max-w-xs" />

## Badge [#badge]

Use `Badge` in the label to highlight a recommended field.

<ComponentPreview name="input-badge" previewClassName="*:max-w-xs" />

## Input Group [#input-group]

To add icons, text, or buttons inside an input, use the `InputGroup` component. See the [Input Group](/docs/components/input-group) component for more examples.

<ComponentPreview name="input-input-group" previewClassName="*:max-w-xs" />

## Button Group [#button-group]

To add buttons to an input, use the `ButtonGroup` component. See the [Button Group](/docs/components/button-group) component for more examples.

<ComponentPreview name="input-button-group" previewClassName="*:max-w-xs" />

## Form [#form]

A full form example with multiple inputs, a select, and a button.

<ComponentPreview name="input-form" previewClassName="h-[32rem]" />

## RTL [#rtl]

To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).

<ComponentPreview name="input-rtl" direction="rtl" previewClassName="*:max-w-xs" />
