Input
Labeled text fields and specialized amount entry.
Default
https://
.xyz
Enter a valid value.
Inline
Stacked
Enter the full SSN.
Input.Amount
Default
Error
Max
Usage
import { Input } from 'regen-ui'
export function EmailField() {
return (
<Input
label="Email"
placeholder="alice@example.com…"
prefix="@"
suffix=".com"
type="email"
/>
)
}Inline fields
import { Fields, Input } from 'regen-ui'
export function NameFields() {
return (
<Fields.Inline className="max-w-[420px]">
<Input label="First name" placeholder="Jane" />
<Input label="Last name" placeholder="Doe" />
</Fields.Inline>
)
}Stacked fields
import { Calendar, Eye } from 'lucide-react'
import { Button, Fields, Input } from 'regen-ui'
export function IdentityForm() {
return (
<Fields className="max-w-[420px]">
<Fields.Inline>
<Input label="First name" placeholder="Jane" />
<Input label="Last name" placeholder="Doe" />
</Fields.Inline>
<Input
label="Date of birth"
placeholder="mm/dd/yyyy"
suffix={
<Button.Icon size="md" title="Open calendar">
<Calendar />
</Button.Icon>
}
/>
<Input
error="Enter the full SSN."
label="Social security number"
placeholder="123-45-6789"
suffix={
<Button.Icon size="md" title="Show SSN">
<Eye />
</Button.Icon>
}
/>
</Fields>
)
}Input.Amount
import { useState } from 'react'
import { Input } from 'regen-ui'
export function PaymentAmount() {
const [value, setValue] = useState('')
return (
<Input.Amount
error={Number(value) > 250 ? 'Amount exceeds available balance.' : undefined}
onChange={setValue}
onMax={() => setValue('250')}
prefix="$"
value={value}
/>
)
}API Reference
Input.Props
| Name | Type | Default | Description |
|---|---|---|---|
error | string | boolean | None | Error message or boolean error state. |
label | ReactNode | None | Label displayed for the input. |
prefix | ReactNode | None | Element rendered before the input (e.g. "https://"). |
suffix | ReactNode | None | Element rendered after the input (e.g. ".com"). |
variant | 'default' | 'stacked' | 'default' | Visual layout variant: 'default' for an external label or 'stacked' for an internal label. |
Inherits InputHTMLAttributes<HTMLInputElement>, except prefix, size. | |||
errorType
string | booleanDefaultNone
Error message or boolean error state.labelType
ReactNodeDefaultNone
Label displayed for the input.prefixType
ReactNodeDefaultNone
Element rendered before the input (e.g. "https://").suffixType
ReactNodeDefaultNone
Element rendered after the input (e.g. ".com").variantType
'default' | 'stacked'Default
Visual layout variant: 'default' for an external label or 'stacked' for an internal label.'default'Inherits
InputHTMLAttributes<HTMLInputElement>, except prefix, size.Input.Amount.Props
| Name | Type | Default | Description |
|---|---|---|---|
error | string | boolean | None | Error message or boolean error state. Error takes precedence over the Max shortcut. |
onChange | (value: string) => void | None | Called with the raw comma-free decimal value. |
onMax | () => void | None | Called when the Max shortcut is pressed. |
prefix | ReactNode | None | Element rendered before the amount input. |
suffix | ReactNode | None | Element rendered after the amount input. |
value | string | None | Raw comma-free decimal value. |
Inherits InputHTMLAttributes<HTMLInputElement>, except children, onChange, type, value. | |||
errorType
string | booleanDefaultNone
Error message or boolean error state. Error takes precedence over the Max shortcut.onChangeType
(value: string) => voidDefaultNone
Called with the raw comma-free decimal value.onMaxType
() => voidDefaultNone
Called when the Max shortcut is pressed.prefixType
ReactNodeDefaultNone
Element rendered before the amount input.suffixType
ReactNodeDefaultNone
Element rendered after the amount input.valueType
stringDefaultNone
Raw comma-free decimal value.Inherits
InputHTMLAttributes<HTMLInputElement>, except children, onChange, type, value.