We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Input Component

The Input component provides a flexible and accessible way to capture user input in forms. With support for different styles, sizes, and states, it adapts to various design requirements while maintaining consistency.

  • Check Circle

    Multiple Variants: Choose between default and underline styles

  • Check Circle

    Flexible Sizing: Three size options to match your design

  • Check Circle

    Built-in Validation: Support for required fields and error states

  • Check Circle

    Accessibility: ARIA-compliant with label support

Create a simple input field with minimal configuration:

<Input placeholder="Enter your name" />

Choose between two distinct visual styles:

<Input variant="default" placeholder="Default variant" />
<Input variant="underline" placeholder="Underline variant" />

Select from three size options:

<Input size="sm" placeholder="Small input" />
<Input size="default" placeholder="Default input" />
<Input size="lg" placeholder="Large input" />

Add labels and validation indicators for better user experience, validation is done when the user has left the input field and the input is invalid:

Username
Email *
Password *
Must be at least 8 characters
<Input label="Username" placeholder="Enter username" />
<Input label="Email" type="email" required placeholder="Enter email" />
<Input
label="Password"
required
type="password"
minLength={8}
sublabel="Must be at least 8 characters"
placeholder="Enter password"
/>

Handle different input states gracefully:

<Input placeholder="Normal state" />
<Input disabled placeholder="Disabled state" />
<Input data-state="error" placeholder="Error state" />

Add a show/hide toggle button for password inputs:

Password
<Input
label="Password"
hideInput
placeholder="Enter password"
/>
Input Component Props Extends <Input> HTMLElement
Prop Type Default Description
label string undefined Text label above the input
sublabel string undefined Helper text below the input
variant default | underline default Visual style variant
size sm | default | lg default Input size
showRequirements boolean true Show requirements
showRequired boolean true Show required symbol
requirements string[] [] Requirements
hideInput boolean false Enables show/hide toggle for password inputs (default is hide)

Limited Time Launch Sale

Build better forms with our Input component. Get started with our AstroJS starter template today!

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes