Skip to main content
  1. Docs
  2. Components
  3. Forms

Input

The bare text box: a filled surface with a bottom line, an icon and affixes. A Field labels it.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<input>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

input.tsx
// From the package: a build keeps only what it uses.
import { Input, Field } from "@qeetrix/react";

// Or from its own path.
import { Input, Field } from "@qeetrix/react/input";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
iconIconSource—A leading icon from @qeetrix/icons: sharp, 16px, decorative.
startAdornmentReactNode—Before the value: a text affix such as ₹.
endAdornmentReactNode—After the value: %, .qeet.in, or a tool such as a Copy button.
size"md" | "lg""md"md is the shared field height; lg is for the one value a sign-in or sign-up step asks for.
value · defaultValue · onValueChangestring—Controlled or not; onValueChange has the value first.
type · placeholder · disabled · readOnly · required…—As on an <input>; its look follows them.
className · style…—Place the box only; ref and the rest go to the input.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
input<div>The box.
input-icon<svg>The leading icon.
input-start<span>Before the value.
input-control<input>The input.
input-end<span>After the value.

04

Field around any control

Field's label, description and error link to the control inside it.

legal-name.tsx
<Field label="Legal name" description="As on your GST certificate." error={errors.legalName}>
  <Input name="legalName" defaultValue={tenant.legalName} />
</Field>

05

A control that isn't an input

A function child: Field hands it the props that name and describe it.

notify-by.tsx
<Field label="Notify by" description="Pick one or more.">
  {(control) => (
    <ToggleGroup {...control} multiple defaultValue={["email"]}>
      <Toggle value="email">Email</Toggle>
      <Toggle value="sms">SMS</Toggle>
    </ToggleGroup>
  )}
</Field>
Next — InputAccessibility