Documentation Index Fetch the complete documentation index at: https://primer.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
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-textStates Default, focus, hover, error, disabled
Examples
Basic Custom Field
< primer-input-wrapper >
< primer-input-label slot = "label" > Discount Code </ primer-input-label >
< div slot = "input" >
< input type = "text" id = "discount" >
</ div >
</ primer-input-wrapper >
< primer-card-form >
< div slot = "card-form-content" >
< primer-input-card-number ></ primer-input-card-number >
< primer-input-card-expiry ></ primer-input-card-expiry >
< primer-input-cvv ></ primer-input-cvv >
<!-- Custom field matching card input style -->
< primer-input-wrapper >
< primer-input-label slot = "label" > Promo Code </ primer-input-label >
< div slot = "input" >
< input type = "text" id = "promo" >
</ div >
</ primer-input-wrapper >
< button type = "submit" > Pay </ button >
</ div >
</ primer-card-form >
Error State
< primer-input-wrapper has-error >
< primer-input-label slot = "label" > Email </ primer-input-label >
< div slot = "input" >
< input type = "email" id = "email" >
</ div >
</ primer-input-wrapper >
Slots
Slot Description labelInput label (use <primer-input-label>) inputInput field content help-textHelper text or success messages
CSS Properties
Spacing
Property Description --primer-space-xsmallGap between label and input --primer-space-mediumInput padding
Border
Property Description --primer-radius-smallBorder radius --primer-color-border-outlined-defaultDefault border --primer-color-border-outlined-hoverHover border --primer-color-border-outlined-focusFocus border --primer-color-border-outlined-errorError border
Background
Property Description --primer-color-background-outlined-defaultDefault background --primer-color-background-outlined-errorError background --primer-color-background-outlined-disabledDisabled background
States
State Trigger Default Initial Hover Mouse over Focus Input focused Error has-error attributeDisabled disabled attribute
Usage Guidelines
Use for custom fields that should match card input styling
Apply has-error attribute 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”
See also
primer-input-label Label component
primer-card-form Card form container