Input

A single-line text input with optional label, hint, and error messaging.

Installation

npx @obi/ui add input

Preview

Must be at least 8 characters.

That username is already taken.

Usage

import Input from '@/src/components/Input/Input';

export default function Example() {
  return (
    <div className="flex flex-col gap-4 max-w-sm">
      <Input label="Email" placeholder="you@example.com" hint="We will never share your email." />
      <Input label="Username" placeholder="johndoe" error="This username is already taken." />
      <Input label="Disabled" placeholder="Cannot edit" disabled />
    </div>
  );
}

Props

NameTypeDefaultDescription
labelstringVisible label rendered above the input; also used to derive the input id.
placeholderstringPlaceholder text shown when the input is empty.
hintstringHelper text rendered below the input when there is no error.
errorstringError message; switches the input to error state and sets aria-invalid.
disabledbooleanfalseDisables the input.