Skip to content

Input

A text input field with built-in label, helper text, error messaging, and icon slots.

Preview

We'll never share your email.
Password must be at least 8 characters.
Username is available.

Sizes

Disabled and read-only

Features

  • Label -- rendered above the field. Always visible for accessibility.
  • Helper text -- muted hint below the field for guidance.
  • Error text -- replaces helper text when validation fails. Colours the border red.
  • Success text -- shows validation success with green border and message.
  • Icon slots -- optional leading and trailing icons inside the field.
  • Sizes -- three height options (sm, md, lg).

Sizes

SizeHeightHorizontal paddingFont size
sm32 px8 px13 px
md40 px12 px14 px
lg48 px16 px16 px

States

StateAppearance
EmptyPlaceholder text visible, default border
FilledEntered text in primary colour
FocusBrand-purple border with focus shadow
DisabledReduced opacity, lighter background, no interaction
Read-onlyLighter background, default cursor, no editing
ErrorRed border, red error message below
SuccessGreen border, green success message below

Props

PropTypeDefaultDescription
labelstring--Visible label text
helperstring--Helper text below the input
errorstring--Error message (replaces helper, colours border)
successstring--Success message (replaces helper, colours border)
size'sm' | 'md' | 'lg''md'Input height and padding
typestring'text'HTML input type
placeholderstring--Placeholder text
disabledbooleanfalseDisables input
readOnlybooleanfalseMakes input non-editable
leadingIconReact.ReactNode--Icon rendered inside the field, before text
trailingIconReact.ReactNode--Icon rendered inside the field, after text
classNamestring--Additional CSS classes on the wrapper

All standard <input> HTML attributes are forwarded to the underlying element.

Code example

React

tsx
import { Input } from '@thepace/lexicon/components';

function SignupForm() {
  return (
    <form>
      <Input
        label="Email address"
        type="email"
        placeholder="you@example.com"
        helper="We'll never share your email."
      />
      <Input
        label="Password"
        type="password"
        error="Password must be at least 8 characters."
      />
      <Input
        label="Username"
        success="Username is available."
        value="jpace"
      />
    </form>
  );
}

Vanilla HTML

html
<div class="lex-input-wrapper">
  <label class="lex-input__label">Email address</label>
  <input class="lex-input lex-input--md" type="email"
         placeholder="you@example.com" />
  <span class="lex-input__helper">We'll never share your email.</span>
</div>

<div class="lex-input-wrapper lex-input-wrapper--error">
  <label class="lex-input__label">Password</label>
  <input class="lex-input lex-input--md" type="password" />
  <span class="lex-input__error">Password must be at least 8 characters.</span>
</div>

<div class="lex-input-wrapper lex-input-wrapper--success">
  <label class="lex-input__label">Username</label>
  <input class="lex-input lex-input--md" value="jpace" />
  <span class="lex-input__success">Username is available.</span>
</div>

CSS class reference

ClassPurpose
.lex-input-wrapperOuter container
.lex-input-wrapper--errorError state on wrapper
.lex-input-wrapper--successSuccess state on wrapper
.lex-inputThe input element
.lex-input--smSmall size
.lex-input--mdMedium size (default)
.lex-input--lgLarge size
.lex-input__labelLabel element
.lex-input__helperHelper text
.lex-input__errorError text
.lex-input__successSuccess text

Accessibility

  • The label prop renders a <label> element connected to the input via htmlFor/id.
  • When error is set, the input receives aria-invalid="true" and aria-describedby pointing to the error message.
  • When helper is set (without error), aria-describedby points to the helper text.
  • Focus ring uses --border-focus with a visible outline for keyboard navigation.
  • disabled inputs receive aria-disabled="true" and reduced opacity.
  • readonly inputs are focusable but not editable.
  • Keyboard: Tab moves focus in/out.

Guidelines

Do

  • Always include a visible label for accessibility.
  • Use helper text for formatting hints (e.g. "Format: DD/MM/YYYY").
  • Show validation errors inline, not in alerts or toasts.

Don't

  • Don't use placeholder text as a label substitute.
  • Don't show error and success states simultaneously.

Released under the MIT License. A product by the pace.