Skip to content
ComponentsMarkdown

Input

Single-line text control aligned to the four Monoplinth control heights (xs to lg). Keeps a 16px (--text-body) font size at every size so mobile browsers never zoom on focus.

Live example

Current value length: 15

Props

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg""md"Control height, corner radius, and horizontal padding.
aria-invalidboolean | "true" | "false"falseSwitches the border to --destructive; wired automatically inside Field.
readOnlybooleanfalseApplies a step 2 muted surface with a trailing lock icon while remaining focusable.
disabledbooleanfalseDisables editing using step 3 background and step 8 text without opacity.
idstringField idOverrides the automatic id provided by an enclosing Field.

Sizes and tokens

Tier / RoleTokenValue
xs--control-height-xs / --control-radius-xs24px height · radius-sm (4px) · 16px text
sm--control-height-sm / --control-radius-sm32px height · radius-sm (4px) · 16px text
md--control-height-md / --control-radius-md40px height · radius-md (8px) · 16px text
lg--control-height-lg / --control-radius-lg48px height · radius-md (8px) · 16px text
Border & focus--input / --destructive / --ringNeutral step 8 border · red step 9 on invalid · 2px focus ring
Read-only--muted / --foreground / --control-icon-*Step 2 surface · normal text · trailing Lock icon · focusable

States

Code

import { Field, Input } from "@freshgemui/monoplinth";

export function Example() {
  return (
    <Field label="Email" description="Used for account recovery." required>
      <Input type="email" placeholder="name@example.com" />
    </Field>
  );
}

Do and don't

Do: Wrap inputs in Field and keep 16px font size
Use Field for visible labels, helper text, and error messages, and preserve the 16px body font size across all control heights.
Don't: Rely on placeholder text as a label or shrink font size below 16px
Do not omit a label in favor of placeholder text, and do not override text-body with text-caption on inputs.

Accessibility

  • Reads id, aria-describedby, aria-invalid, and aria-required from the nearest Field context automatically.
  • Enforces 16px (text-body) across xs through lg to prevent iOS Safari auto-zoom on focus.
  • Uses a 2px --ring outline with a 2px offset on :focus-visible only.
  • Keeps disabled contrast predictable with step 3 background and step 8 text (no opacity).

Rationale

Sharing --control-height-* and --control-radius-* with Button guarantees horizontal alignment in toolbars and inline forms, while locking the font size at 16px eliminates mobile zoom jumps.