Form

Input

A text field — accessible, themeable, in React (@bpdm/ui) and Angular (@bpdm/ng).

The Input is a text field built on the native <input>, so every native type, attribute and form behaviour works. In React it's the Input component; in Angular it's the bpdmInput attribute directive on a real <input>.

Usage

input-usage.tsx
import { Input } from '@bpdm/ui/input';

export function InputUsage() {
  return <Input placeholder="you@company.com" />;
}

Variants

The variant prop offers outline (default, bordered box) and underline (a single bottom border).

input-variants.tsx
import { Input } from '@bpdm/ui/input';

export function InputVariants() {
  return (
    <div className="flex flex-col gap-3">
      <Input variant="outline" placeholder="Outline (default)" />
      <Input variant="underline" placeholder="Underline" />
    </div>
  );
}

Sizes

The size prop offers sm, md (default), and lg.

input-sizes.tsx
import { Input } from '@bpdm/ui/input';

export function InputSizes() {
  return (
    <div className="flex flex-col gap-3">
      <Input size="sm" placeholder="Small" />
      <Input size="md" placeholder="Medium" />
      <Input size="lg" placeholder="Large" />
    </div>
  );
}

States

Use the native attributes — disabled, a value, and aria-invalid for the error state (the field turns destructive-coloured automatically).

input-states.tsx
import { Input } from '@bpdm/ui/input';

export function InputStates() {
  return (
    <div className="flex flex-col gap-3">
      <Input placeholder="Default" />
      <Input defaultValue="With a value" />
      <Input aria-invalid defaultValue="Invalid value" />
      <Input disabled placeholder="Disabled" />
    </div>
  );
}

With icons

In React, add a leading or trailing icon with startIcon / endIcon and the field pads itself to clear them.

input-icons.tsx
import { Search, Calendar, Mail, Lock } from 'lucide-react';
import { Input } from '@bpdm/ui/input';

export function InputIcons() {
  return (
    <div className="flex flex-col gap-3">
      <Input placeholder="Search" startIcon={<Search />} />
      <Input placeholder="Pick a date" endIcon={<Calendar />} />
      <Input type="email" placeholder="Email" startIcon={<Mail />} />
      <Input type="password" placeholder="Password" startIcon={<Lock />} />
    </div>
  );
}

Input types

Any native type works — email, password, number, and the rest.

input-types.tsx
import { Input } from '@bpdm/ui/input';

export function InputTypes() {
  return (
    <div className="flex flex-col gap-3">
      <Input type="email" placeholder="email@company.com" />
      <Input type="password" placeholder="••••••••" />
      <Input type="number" placeholder="0" />
    </div>
  );
}

Form field

Pair the input with a <label> (linked via htmlFor/for) and an optional helper line. This is the accessible, recommended pattern.

We'll never share your email.

input-field.tsx
import { Mail } from 'lucide-react';
import { Input } from '@bpdm/ui/input';

export function InputField() {
  return (
    <div className="flex flex-col gap-1.5">
      <label htmlFor="email" className="text-sm font-medium">
        Email
      </label>
      <Input id="email" type="email" placeholder="you@company.com" startIcon={<Mail />} />
      <p className="text-xs text-muted-foreground">We'll never share your email.</p>
    </div>
  );
}

API

PropTypeDefaultDescription
variantoutline | underlineoutlineBordered box, or a single bottom border.
sizesm | md | lgmdField height and text size.
startIconReactNode—React only — icon rendered at the leading edge.
endIconReactNode—React only — icon rendered at the trailing edge.

All native <input> attributes (type, placeholder, value, disabled, readOnly, aria-invalid, …) are supported. In Angular, variant and size are @Inputs on the input[bpdmInput] directive.

Accessibility

  • Always pair the input with a <label> linked by htmlFor (React) / for (Angular), or give it an aria-label.
  • Set aria-invalid when a field fails validation — bpdm styles it with the destructive colour, and screen readers announce the error state.
  • It's a native <input>, so keyboard and assistive-tech behaviour are built in.

Internationalization

  • The input renders no text of its own — pass a translated placeholder, a translated accessible name (associated <label> or aria-label), and translated help/error via aria-describedby.
  • RTL-safe: the start/end icon padding uses logical properties (ps/pe, start/end), so the field and its icons mirror under dir="rtl". See the Internationalization guide.

On this page