Input Anatomy
Every single-line text input in Primebrick shares the same internal geometry for trailing actions.
Anatomy
Code
Rules
- Glyph edge = 12px from the right border — symmetric to the input's
px-3left padding. Achieved viaright-1.5on the sharedinputTrailingIconButtonClasses(28px button, 16px icon). - Clear button =
Erasericon, always the rightmost element. Rendered only ineditablemode with a non-empty value; hidden onreadonly(replaced by the copy button) anddisabled. Opt out withclearable={false}. - Second slot sits at
right-10(e.g. an async-validation status icon left of the clear button).TextInput'strailingsnippet must self-position left of the clear zone. - Overflow guard: the input reserves trailing space via padding —
pr-9for one CTA,pr-14/pr-[4.5rem]for two,pr-24for three. Text and cursor never slide under the CTAs. - Glyph size = 16px, always. Every inner icon-only control (clear
Eraser,Eye/EyeOff,Copy,Check/status,Xremove) renders asize-4glyph. This is enforced by[&>svg]:size-4inside the sharedinputTrailingIconColorClasses— do not set a size on the icon itself. The button's hit area may vary independently of the glyph size. Excluded from this rule: decorative glyphs that are part of a trigger's content (e.g. thesize-3caret inside a prefix selector CTA like phone/URL) and leading icons. - Trailing buttons carry
tabindex={-1}andz-10(the input's animated border wrapper isz-1).
Field hints
Non-error help is never an inline line under the control — it lives in the
label tooltip (FormLabelWithPriorityHelp): a size-3.5 icon plus an
optional italic qualifier (e.g. (optional)), opening a priority-aware
tooltip on hover. The trigger icon mirrors priority: WARNING →
TriangleAlert, ERROR → OctagonX, otherwise HelpCircle.
- SuperForms pages:
FormLabelWithPriorityHelpinsideFormLabel. - Non-superforms rows:
PrimeField'shelpprop (accepts aFieldHelpobject or a rawMetaColumnfor metadata-driven tooltips). - Switch rows:
SwitchField'stooltip/tooltipTitle/tooltipPriorityprops (descriptionis deprecated).
Priorities: HINT = format guidance · INFORMATION = explainers/markers ·
WARNING = irreversible semantics · ERROR = hard constraints.
Every tooltip shows a priority-tinted title — pass title explicitly or the
per-priority default (app.common.tooltipTitle.<priority>) is used.
Components
Use TextInput ($lib/components/ui/input) for any plain single-line text
field — it owns clear/copy/trailing per this contract. Specialized inputs
(EmailInput, UrlInput, PhoneInput, Password fields,
SmartRegexInput) follow the same trailing geometry.
Use InputGroup/InputGroupAddon (flow-based) when the trailing element is
a real inner button — e.g. a text CTA like "search in" or a proto://
selector — rather than an icon.
Ghost chrome. Inputs embedded inside an already-bordered container
(color picker footer, toolbar strips) use inputGhostChromeClasses from
$lib/components/ui/input/input-chrome — the formalized ghost: subtle
always-visible border-foreground/25 on a transparent background, hover
foreground/40, focus foreground/50 + ring-foreground/20 (same as the
toolbar SearchBar / ComboSelect variant="ghost"). It is NOT the
borderless button ghost — that look exists as inputBorderlessChromeClasses
but is almost never appropriate (undiscoverable control).