<primer-input-wrapper>
Provides consistent styling and structure for input fields. Used internally by card inputs and available for custom fields to match Primer’s visual style.Quick Reference
| Slots | label, input, help-text |
| States | Default, focus, hover, error, disabled |
Examples
Basic Custom Field
With Card Form
Error State
Slots
| Slot | Description |
|---|---|
label | Input label (use <primer-input-label>) |
input | Input field content |
help-text | Helper text or success messages |
CSS Properties
Spacing
| Property | Description |
|---|---|
--primer-space-xsmall | Gap between label and input |
--primer-space-medium | Input padding |
Border
| Property | Description |
|---|---|
--primer-radius-small | Border radius |
--primer-color-border-outlined-default | Default border |
--primer-color-border-outlined-hover | Hover border |
--primer-color-border-outlined-focus | Focus border |
--primer-color-border-outlined-error | Error border |
Background
| Property | Description |
|---|---|
--primer-color-background-outlined-default | Default background |
--primer-color-background-outlined-error | Error background |
--primer-color-background-outlined-disabled | Disabled background |
States
| State | Trigger |
|---|---|
| Default | Initial |
| Hover | Mouse over |
| Focus | Input focused |
| Error | has-error attribute |
| Disabled | disabled attribute |
Usage Guidelines
Do
- Use for custom fields that should match card input styling
- Apply
has-errorattribute for validation errors
Don’t
- Don’t use for card inputs (they handle their own wrappers)
Content Guidelines
help-text slot
| Do | Don’t |
|---|---|
| ”3 digits on the back of your card" | "See card” (too terse) |
| Keep to one short sentence | Write a paragraph of instructions |
Error message placement
| Do | Don’t |
|---|---|
Place error text in the help-text slot when has-error is set | Place errors outside the wrapper (breaks visual grouping) |
| Keep messages specific: “Enter a valid code” | Use generic messages: “Invalid input” |
Related
- primer-input-label — Label component
- primer-card-form — Card form container