Input

Displays a form input field or a component that looks like an input field.

Installation

CLI

Install the component using the StarUI CLI:

star add input

Examples

Reactive Input with Validation

Real-time input validation using signals

Username must be at least 3 characters, letters/numbers/underscores only

✓ Username is available

Please enter a valid email address

✓ Valid email format

Input with Buttons

Combine inputs with action buttons

Input with Icons

Inputs with custom icons that adapt to dark mode

Input States

Disabled, read-only, and required inputs

This field is required

File Upload

File input fields with accept filters

PNG, JPG up to 2MB

PDF, DOC, DOCX files (multiple allowed)

API Reference

Props

Prop Type Default Description
type InputType text Input type (text, email, password, number, etc.)
placeholder str | None None Placeholder text shown when empty
signal str | None None Datastar signal for reactive binding
validation str | None None JS expression to set <signal>_valid on input
value str | None None Initial value for non-reactive usage
disabled bool False Disable the input and style accordingly
readonly bool False Make input read-only without disabling
required bool False Mark the input as required
cls str '' Additional CSS classes for layout/styling