Skip to Content

Input

A flexible text input component with support for labels, helper text, icons, addons, and validation states.

Import

import { Input } from "@raydenui/ui"; import type { InputProps, InputSize } from "@raydenui/ui";

Usage

Basic

<Input placeholder="Enter your name" />

With Label

<Input label="Email" placeholder="you@example.com" />

With Helper Text

Must be at least 8 characters

<Input label="Password" type="password" helperText="Must be at least 8 characters" />

Sizes

<Input size="xs" placeholder="Extra small" /> <Input size="sm" placeholder="Small (default)" /> <Input size="md" placeholder="Medium" /> <Input size="lg" placeholder="Large" />

Validation States

Email is available

Please enter a valid email

// Success <Input label="Email" success="Email is available" defaultValue="user@example.com" /> // Error <Input label="Email" error="Please enter a valid email" defaultValue="invalid-email" />

With Icons

// Leading icon <Input leadingIcon="search" placeholder="Search..." /> // Trailing icon <Input trailingIcon="x" placeholder="Clearable input" /> // Both icons <Input leadingIcon="mail" trailingIcon="check" placeholder="Email" />

With Text Addon

.com
<Input addonRight=".com" placeholder="domain" />

With Leading/Trailing Addons

Leading and trailing addons render as separate bordered sections.

https://
$
USD
// Leading addon (e.g., dropdown) <Input leadingAddon={<span>https://</span>} placeholder="example.com" /> // Trailing addon (e.g., button) <Input trailingAddon={<Button size="sm">Search</Button>} placeholder="Search..." /> // Both addons <Input leadingAddon={<span>$</span>} trailingAddon={<span>USD</span>} placeholder="0.00" />

Read-only and Disabled

// Read-only <Input label="ID" value="USR-12345" readOnly /> // Disabled <Input label="Email" placeholder="Enter email" disabled />

Props

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg""sm"Input size variant
labelstring—Label text above the input
helperTextstring—Helper text below the input
errorstring | boolean—Error message or boolean
successstring | boolean—Success message or boolean
leadingIconReactNode | IconName—Icon on the left
trailingIconReactNode | IconName—Icon on the right
addonRightstring—Text addon on the right
leadingAddonReactNode—Separated section before input
trailingAddonReactNode—Separated section after input
wrapperClassNamestring—Class for the wrapper div
classNamestring—Class for the input element

The component also accepts all native <input> HTML attributes.

Accessibility

  • Uses semantic <input> element
  • Labels are properly associated via htmlFor
  • Helper text linked via aria-describedby
  • Error states announced via aria-invalid
  • Required state indicated via aria-required
Last updated on