# Input: Read only

> `readOnly` keeps the value focusable, selectable and submitted, with a muted surface so it doesn’t look editable. Prefer it over `disabled` for values people need to copy.

Example: https://hextaui.com/docs/input/examples/read-only
Component docs: https://hextaui.com/docs/input.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/input-read-only.json
```

This adds `components/examples/input/read-only.tsx` with the Input component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/input/read-only.tsx"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

export function InputReadOnly() {
  return (
    <div className="flex w-full max-w-sm flex-col gap-2">
      <Label htmlFor="input-read-only">API key</Label>
      <Input id="input-read-only" readOnly defaultValue="sk_live_51H8a…f2Qz" />
    </div>
  )
}
```

## Props in this example

### Input

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `string \| number \| string[]` | – |  |
| `readOnly` | `boolean` | `false` |  |

## More Input examples

- [Sizes](https://hextaui.com/docs/input/examples/sizes.md)
- [With a description](https://hextaui.com/docs/input/examples/description.md)
- [Invalid](https://hextaui.com/docs/input/examples/invalid.md)
- [Native validation](https://hextaui.com/docs/input/examples/native-validation.md)
- [Disabled](https://hextaui.com/docs/input/examples/disabled.md)
- [File](https://hextaui.com/docs/input/examples/file.md)
- [Input types](https://hextaui.com/docs/input/examples/types.md)
- [Controlled](https://hextaui.com/docs/input/examples/controlled.md)
- [With a button](https://hextaui.com/docs/input/examples/with-button.md)
- [Grid](https://hextaui.com/docs/input/examples/grid.md)
- [Long content](https://hextaui.com/docs/input/examples/long-content.md)
- [Right to left](https://hextaui.com/docs/input/examples/rtl.md)
