Skip to main content

Addon

Input with prepended or appended elements - static text, icons, or buttons - attached seamlessly to one or both ends of a form control. Addons visually and structurally extend an input so consumers can show currency symbols, units, prefixes like @, or action buttons like "Search" without breaking the control's layout or accessibility semantics.

Usage​

When to use

  • To show a unit or symbol tied to an input (e.g. $, %, .00, kg)
  • To prefix or suffix a value (e.g. https://, @username)
  • To attach a single-action button to an input (e.g. a search submit)

When not to use

  • For grouping multiple related form controls - use fieldset
  • For visually joined standalone buttons - use group
  • For helper text below the input - use the form field description slot

Do

  • Keep addon text short (one or two characters where possible)
  • Pair addon button labels with clear action verbs
  • Associate addon text with the input via aria-describedby when it clarifies the input's purpose

Don't

  • Don't use multiple addons on the same side
  • Don't hide essential information in an addon - critical context belongs in the label or description
  • Don't attach interactive addons without giving them an accessible name

API​

Slots​

SlotRequiredDescription
contentYesMain form control (input, textarea, select, or their mirror-class equivalents).
prepend-Content prepended to the form control.
append-Content appended to the form control.

Props​

PropTypeDefaultDescription
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.

Examples​

Text addon​

Static text prepended or appended to an input, such as a currency symbol or unit.

Icon addon​

Icon prepended or appended to an input, such as a search icon.

Button addon​

Button attached to an input end, such as a search submit trigger.

Sizes​

Small and large size variants matching input sizes.

Accessibility​

  • WCAG 2.2 AA
  • Addon text is associated with the input via aria-describedby or by wrapping in a <label>
  • Button addons carry a descriptive accessible name
  • Focus indicator visible on any interactive addon
  • fieldset - semantic grouping of related form controls
  • group - visually joined button grouping
  • button - standalone button component