Input

Text input with start and end adornments, a clear button, a password visibility toggle, and presets for SSN and birthday.

import { Input } from "@plexui/ui/components/Input";

Examples

Overview

Variants

Sizing & roundness

size
gutterSize
0/16

Start adornment

Clear button

size

End adornment

0/16

Password with visibility toggle

variant
size

SSN input

variant
size

Birthday input

variant
size

Birthday with validation

variant
size

Disabled

Invalid

Plex UI also provides a FieldError component (@plexui/ui/components/FieldError) that pairs well with invalid inputs. It renders an error icon with a message styled for form validation; a long message wraps under its first line, and icon={false} leaves the icon out where the message stands alone, such as under a centered code input.

Auto select text

Autofill extensions

With button

variant
size

Optical alignment

Use opticallyAlign with either "start" or "end" to offset the gutter, aligning the input text with surrounding content. Works with Field: pass opticallyAlign on the Field and it forwards to the child control automatically.

opticallyAlign="start"
We'll never share your email.

Input shares the unified 9-step size scale with Button, Select, SelectControl, and SegmentedControl. Set the same size on adjacent controls and they'll align perfectly.

API

PropTypeDefaultDescription
variant"outline" | "soft" | "ghost""outline"Visual style of the input; ghost has no border and no fill
size"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl""md"Controls the size of the input
gutterSize"2xs" | "xs" | "sm" | "md" | "lg" | "xl"—Controls gutter on the edges; defaults to value from size
disabledbooleanfalseDisables the input visually and from interactions
readOnlybooleanfalseMakes the input read-only and hides the clear button
invalidbooleanfalseMark the input as invalid
allowAutofillExtensionsbooleantype === "password" || !!nameAllow autofill extensions to appear in the input
autoSelectbooleanfalseSelect all contents of the input when mounted
startAdornmentReactNode—Content rendered at the start of the input
endAdornmentReactNode—Content rendered at the end of the input
onClear() => void—When provided, displays a clear button that appears when the input has a value
onAutofill() => void—Called when the browser autofills the input
pillbooleanfalseFully rounded pill shape
opticallyAlign"start" | "end"—Applies a negative margin using the current gutter to optically align with surrounding content

className applies to the container. Every other <input> attribute and handler (value, defaultValue, onChange, placeholder, maxLength, ...) goes to the <input>, and ref points at it.

Input.AdornmentButton

PropTypeDefaultDescription
colorSemanticColor—Tint of the pressed (aria-pressed="true") state; the neutral primary-soft tint when unset
typestring"button"Button type

Styling

Input reads these component tokens. Override them at any scope to restyle it:

  • --input-border-color-invalid: border color invalid (default var(--color-border-danger-outline))
  • --input-gap-lg: gap lg (default 10px)
  • --input-gap-md: gap md (default 8px)
  • --input-gap-sm: gap sm (default 6px)
  • --input-gap-xs: gap xs (default 4px)
  • --input-outline-border-color: outline border color (default var(--color-border-primary-outline))
  • --input-outline-border-color-focus: outline border color focus (default var(--alpha-50))
  • --input-outline-border-color-hover: outline border color hover (default light-dark(var(--alpha-25), var(--alpha-30)))
  • --input-placeholder-text-color: placeholder text color (default var(--color-text-tertiary))
  • --input-soft-background-color: soft background color (default var(--color-background-primary-soft-alpha))
  • --input-soft-border-color-focus: soft border color focus (default var(--alpha-20))
  • --input-text-color: text color (default var(--color-text))