Input
---import { Input } from "@/components/starwind/input";---
<Input placeholder="Type something..." />import { Input } from "@/components/starwind/input";
export function Example() { return ( <Input placeholder="Type something..." /> );}Installation
pnpx starwind@latest add inputnpx starwind@latest add inputyarn dlx starwind@latest add inputUsage
---import { Input } from "@/components/starwind/input";---
<Input placeholder="Type something..." />import { Input } from "@/components/starwind/input";
export function Example() { return ( <Input placeholder="Type something..." /> );}Sizes
---import { Input } from "@/components/starwind/input";---
<Input size="sm" placeholder="Small input" /><Input size="md" placeholder="Medium input" /><Input size="lg" placeholder="Large input" />import { Input } from "@/components/starwind/input";
export function Example() { return ( <> <Input size="sm" placeholder="Small input" /> <Input size="md" placeholder="Medium input" /> <Input size="lg" placeholder="Large input" /> </> );}Disabled
---import { Input } from "@/components/starwind/input";---
<Input disabled placeholder="Disabled input" /><Input disabled value="Disabled with value" />import { Input } from "@/components/starwind/input";
export function Example() { return ( <> <Input disabled placeholder="Disabled input" /> <Input disabled value="Disabled with value" /> </> );}Input Types
---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" />import { Input } from "@/components/starwind/input";
export function Example() { return ( <> <Input type="email" placeholder="Email input" /> <Input type="password" placeholder="Password input" /> <Input type="number" placeholder="Number input" /> <Input type="file" /> </> );}API Reference
Styled Component API
These props are added or materially changed by the installed styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Expand a prop to see named type definitions and framework-specific imports. Follow the Primitive and Runtime links for lower-level behavior props.
Input
Inherits input attributes. Omits `children`, `defaultValue`, `size`, and `value`.
Contains the following additional props:
Prop Type Default Toggle details
defaultValue string | number | string[] —
- Description
- Sets the initial value when the component is uncontrolled.
- Classification
- Primitive override
- Type imports
- React
import type { InputValue } from "@starwind-ui/react"; - Primitive prop
- input.Root.defaultValue
size "sm" | "md" | "lg" "md"
- Description
- Selects the component's visual size.
- Classification
- Styled variant
value string | number | string[] —
- Description
- Controls or identifies the component value.
- Classification
- Primitive override
- Type imports
- React
import type { InputValue } from "@starwind-ui/react"; - Primitive prop
- input.Root.value
Primitive And Runtime API
Use these references when you need the lower-level behavior APIs behind Input.
Primitive API
Runtime API
- Input primitive
createInputfrom@starwind-ui/runtime/input
Changelog
View version history v2.0.1 8 releases
v2.0.1
- Updated React Runtime state synchronization so canceled proposals stay uncommitted and accepted changes remain aligned.
v2.0.0
- Rebuilt Input on Starwind Runtime for value synchronization while retaining native input attributes.
- See the Input Primitive for the underlying unstyled anatomy and behavior API.
v1.3.3
- Refactor tailwind variants functions into separate
variants.tsfile
v1.3.1
- add
aria-invalidstyling
v1.3.0
- style and focus state updates
v1.2.0
- Add
data-slotattribute 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
VariantPropsfromtailwind-variants. This provides greater type safety and cleans up component frontmatter.
v1.1.0
tailwind-variantsnow implemented. This usestailwind-mergeunder the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the “class” prop.