1. Documentation
  2. Forms
  3. Input
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Input

A text input that is either a bare control or an entire accessible field, depending on the props you pass.

Loading documentation…

Label< PreviousTextareaNext >

Powered by heyo

On this page

UsageAs a bare controlErrorsSizesDisabledProperties

Lowercase letters, numbers and dashes.

<Inputlabel="Project name"placeholder="my-worker"description="Lowercase letters, numbers and dashes."/>

Input is pressed into the surface with an inset shadow and edged with a 1px ring. Focus thickens that ring to 1.5px and changes its colour rather than adding a second halo — one ring, two states, no layout shift.

Pass label (or description or error) and you get the full Field layout with its accessible wiring for free. Omit them and you get a bare control for a custom layout — supply aria-label in that case.

Usage

tsx
import { Input } from "@heyo-sh/heyo-ui";<Input label="Email" type="email" placeholder="you@example.com" />;

As a bare control

https://
.heyo.sh
<Input icon={IconSearch} placeholder="Search…" aria-label="Search" /><Input prefix="https://" suffix=".heyo.sh" placeholder="acme" aria-label="Subdomain" />

icon and iconEnd sit inside the control; prefix and suffix are flush addons on its edges, on the recessed surface. An addon is part of the value ("https://"), an icon is a hint about it.

Errors

Enter a valid email address.

At least 8 characters.

<Input label="Email" defaultValue="not-an-email" error="Enter a valid email address." /><Inputlabel="Password"type="password"minLength={8}error={{ message: "At least 8 characters", match: "tooShort" }}/>

Sizes

The four control heights: 20, 26, 32 and 40px. base is the default, and it is the height every other control in the library shares.

<Input size="xs" placeholder="xs" aria-label="xs" /><Input size="sm" placeholder="sm" aria-label="sm" /><Input size="base" placeholder="base" aria-label="base" /><Input size="lg" placeholder="lg" aria-label="lg" />

Disabled

A disabled input drops to the recessed surface, because a field you cannot type into should not look like a field you can.

<Input label="Project ID" defaultValue="prj_8f21c3d9" disabled />
Related controls

Textarea takes the same props plus autoResize; NumberField is the numeric sibling, and OtpField the one-time-code one.

Properties

labelReactNodeoptional

Renders the full field layout — label, description, error, aria-describedby.

descriptionReactNodeoptional

Muted helper text under the control.

errorFieldErroroptional

A message, or { message, match } tied to the browser's ValidityState.

optionalbooleanoptional

Adds the muted "Optional" marker to the label.

labelAsideReactNodeoptional

A right-aligned slot on the label row.

size"xs" | "sm" | "base" | "lg"optional

Control height. It defaults to base (32px).

iconIconLikeoptional

Rendered inside the control, before the text.

iconEndIconLikeoptional

Rendered inside the control, after the text.

prefixReactNodeoptional

A flush addon on the left edge, for example https://.

suffixReactNodeoptional

A flush addon on the right edge, for example .heyo.sh.

fieldClassNamestringoptional

Class for the outer field wrapper, used only when a label, description or error is present.

classNamestringoptional

Class for the control itself.

refRef<HTMLInputElement>optional

Forwarded to the <input>.

Every other <input> attribute — type, value, defaultValue, onChange, required, minLength, autoComplete — is passed straight through.