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
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "sm" | "md" | "lg" | "md" | Control height, corner radius, and horizontal padding. |
| aria-invalid | boolean | "true" | "false" | false | Switches the border to --destructive; wired automatically inside Field. |
| readOnly | boolean | false | Applies a step 2 muted surface with a trailing lock icon while remaining focusable. |
| disabled | boolean | false | Disables editing using step 3 background and step 8 text without opacity. |
| id | string | Field id | Overrides the automatic id provided by an enclosing Field. |
Sizes and tokens
| Tier / Role | Token | Value |
|---|---|---|
| xs | --control-height-xs / --control-radius-xs | 24px height · radius-sm (4px) · 16px text |
| sm | --control-height-sm / --control-radius-sm | 32px height · radius-sm (4px) · 16px text |
| md | --control-height-md / --control-radius-md | 40px height · radius-md (8px) · 16px text |
| lg | --control-height-lg / --control-radius-lg | 48px height · radius-md (8px) · 16px text |
| Border & focus | --input / --destructive / --ring | Neutral 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, andaria-requiredfrom the nearestFieldcontext automatically. - Enforces
16px(text-body) acrossxsthroughlgto prevent iOS Safari auto-zoom on focus. - Uses a
2px--ringoutline with a2pxoffset on:focus-visibleonly. - 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.