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

errorOptional
Typestring | boolean
DefaultNone
Error message or boolean error state.
labelOptional
TypeReactNode
DefaultNone
Label displayed for the input.
prefixOptional
TypeReactNode
DefaultNone
Element rendered before the input (e.g. "https://").
suffixOptional
TypeReactNode
DefaultNone
Element rendered after the input (e.g. ".com").
variantOptional
Type'default' | 'stacked'
Default'default'
Visual layout variant: 'default' for an external label or 'stacked' for an internal label.
Inherits InputHTMLAttributes<HTMLInputElement>, except prefix, size.

Input.Amount.Props

errorOptional
Typestring | boolean
DefaultNone
Error message or boolean error state. Error takes precedence over the Max shortcut.
onChangeRequired
Type(value: string) => void
DefaultNone
Called with the raw comma-free decimal value.
onMaxOptional
Type() => void
DefaultNone
Called when the Max shortcut is pressed.
prefixOptional
TypeReactNode
DefaultNone
Element rendered before the amount input.
suffixOptional
TypeReactNode
DefaultNone
Element rendered after the amount input.
valueRequired
Typestring
DefaultNone
Raw comma-free decimal value.
Inherits InputHTMLAttributes<HTMLInputElement>, except children, onChange, type, value.