# Input

<FrameworkCodeSwitcher>
  <div slot="astro">
```astro
---
import { Input } from "@/components/starwind/input";
---

<Input placeholder="Type something..." />
```
  </div>
  <div slot="react">
```tsx
import { Input } from "@/components/starwind/input";

export function Example() {
  return (
    <Input placeholder="Type something..." />
  );
}
```
  </div>
</FrameworkCodeSwitcher>

## Installation

```bash
npx starwind@latest add input
```

## Usage

### size

```astro
---
import { Input } from "@/components/starwind/input";
---

<Input size="sm" placeholder="Small input" />
<Input size="md" placeholder="Medium input" />
<Input size="lg" placeholder="Large input" />
```

### disabled

```astro
---
import { Input } from "@/components/starwind/input";
---

<Input disabled placeholder="Disabled input" />
<Input disabled value="Disabled with value" />
```

### with type

```astro
---
import { Input } from "@/components/starwind/input";
---

<Input type="email" placeholder="Email input" />
<Input type="password" placeholder="Password input" />
<Input type="number" placeholder="Number input" />
<Input type="file" />
```

## Framework Availability
Input is available for Astro and React.
Astro available; React available
| Framework | Status | Notes |
| --- | --- | --- |
| Astro | available | - |
| React | available | - |
## API Reference
### Input
| Prop | Type | Required | Default | Kind | Description |
| --- | --- | --- | --- | --- | --- |
| `defaultValue` | `string \| number \| string[]` | No | - | Primitive override | Sets the initial value when the component is uncontrolled. |
| `size` | `"sm" \| "md" \| "lg"` | No | `"md"` | Styled variant | Selects the component's visual size. |
| `value` | `string \| number \| string[]` | No | - | Primitive override | Controls or identifies the component value. |
- Inherits input attributes. Omits `children`, `defaultValue`, `size`, and `value`.
### Primitive And Runtime API
Behavior, state, events, form participation, and imperative methods are documented in the lower-level references.
- Primitive: [Input Primitive](/docs/primitives/input/)
- Runtime factory: [`createInput`](/docs/runtime/#create-input) from `@starwind-ui/runtime/input`

## Changelog

### v2.0.0

- Rebuilt Input on Starwind Runtime for value synchronization while retaining native input attributes.
- See the [Input Primitive](/docs/primitives/input/) for the underlying unstyled anatomy and behavior API.

### v1.3.3 

- Refactor tailwind variants functions into separate `variants.ts` file

### v1.3.1 

- add `aria-invalid` styling

### v1.3.0 

- style and focus state updates

### v1.2.0

- Add `data-slot` attribute to enable global styling updates

### v1.1.1

- Add eslint disable comment for allowing the label to not have an associated control (this is user responsibility)
- Adjust component to use type `VariantProps` from `tailwind-variants`. This provides greater type safety and cleans up component frontmatter.

### v1.1.0

- `tailwind-variants` now implemented. This uses `tailwind-merge` under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the "class" prop.