- Docs
- Components
- 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
// 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.
| Prop | Type | Default | What it does |
|---|---|---|---|
icon | IconSource | — | A leading icon from @qeetrix/icons: sharp, 16px, decorative. |
startAdornment | ReactNode | — | Before the value: a text affix such as ₹. |
endAdornment | ReactNode | — | 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 · onValueChange | string | — | 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-slot | Element | What 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.
<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.
<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>