Components · Forms · Add-on
Back to Add-on typesAdd-on
Use for a single-line text field that needs a fixed prefix and/or suffix segment attached to it, like a protocol prefix on a URL or a currency symbol on a price.
Properties
Size, corner radius, label, placeholder, prefix and suffix are properties of the same component, not separate fields - change them below to check this field's style and states in the Live Preview.
Live Preview
All 3 types compared side by side, each in all 8 states. One full matrix is rendered per selected combination of Size and Corner radius - check more than one option in a dropdown to see every combination side by side.
When to use
Any single-line text field whose value is naturally paired with a fixed prefix or suffix, so the field alone would be ambiguous or need repeated typing.
Validation
The prefix and suffix segments are static and never part of what gets validated - validation applies only to the core input value, and the add-on itself visually anchors the format that value is expected to match.
- Required marking - mark the field as a whole required, next to its label, the same as any text field - the add-on segment doesn't change how required state is shown.
- Format validation - check the typed value against the format the add-on implies, not a generic pattern - a username field with an "@company.com" suffix should validate the local-part on blur, since the add-on already fixes the rest of the format.
- Error message - reference the add-on's format directly, e.g. "Enter a username before @company.com," rather than a generic "Invalid input" that leaves the user guessing what "before @company.com" even means.
- Recovery - keep the add-on visible and unchanged while the core value is in an error state, so the expected format stays in view as the user corrects the input.
Component Guide
Overview
Add-on is a single-line text field with a fixed, non-editable prefix and/or suffix segment attached directly to it - used when the value alone would be ambiguous or would force the user to retype a constant part of it every time.
When to Use
- A value with a fixed protocol or domain prefix - https:// before a URL.
- A currency symbol on a price - $ before a numeric amount.
- A username handle with a fixed platform prefix - @ before a handle, or a fixed email domain suffix.
When Not to Use
- A value with no natural constant part - use a plain Input - adding an empty or irrelevant add-on segment is just visual noise.
- A prefix/suffix that the user should be able to edit or choose - use a Select alongside the field, or a Group Button, instead of a fixed, non-editable add-on.
- Multiple independent constant parts on both sides that combine in complex ways - consider breaking the field into clearly labeled separate inputs instead.
Best Practices
- Keep the add-on segment visually distinct but clearly non-editable (different background, no cursor) so users don't try to click into it.
- Use the add-on only for a genuinely constant part of the value - never for something that varies per use case.
- Make sure the combined value (prefix + typed value + suffix) is what actually gets submitted, not just displayed.
Do and Don't
Do
The add-ons carry the unit, so the input holds only the number the user actually has to type.
Don't
An add-on used as a label steals the width the value needs and leaves the field itself unlabelled. Add-ons are for units and fixed fragments, not instructions.
Accessibility
- The prefix/suffix text is exposed to assistive technology alongside the field's label, so its meaning isn't lost for screen-reader users.
- The editable portion remains a real, independently focusable input - the add-on segments are not part of the tab order since they aren't interactive.
- Sufficient contrast between the add-on segment and the editable field, so the boundary between fixed and editable text is visually clear.
Related Components
Input, Select, Number.
{
"component": "Add-on",
"category": "Forms",
"summary": "Add-on is a single-line text field with a fixed, non-editable prefix and/or suffix segment attached directly to it - used when the value alone would be ambiguous or would force the user to retype a constant part of it every time.",
"whenToUse": [
"A value with a fixed protocol or domain prefix - https:// before a URL.",
"A currency symbol on a price - $ before a numeric amount.",
"A username handle with a fixed platform prefix - @ before a handle, or a fixed email domain suffix."
],
"whenNotToUse": [
"A value with no natural constant part - use a plain Input - adding an empty or irrelevant add-on segment is just visual noise.",
"A prefix/suffix that the user should be able to edit or choose - use a Select alongside the field, or a Group Button, instead of a fixed, non-editable add-on.",
"Multiple independent constant parts on both sides that combine in complex ways - consider breaking the field into clearly labeled separate inputs instead."
],
"bestPractices": [
"Keep the add-on segment visually distinct but clearly non-editable (different background, no cursor) so users don't try to click into it.",
"Use the add-on only for a genuinely constant part of the value - never for something that varies per use case.",
"Make sure the combined value (prefix + typed value + suffix) is what actually gets submitted, not just displayed."
],
"doAndDont": {
"do": "The add-ons carry the unit, so the input holds only the number the user actually has to type.",
"dont": "An add-on used as a label steals the width the value needs and leaves the field itself unlabelled. Add-ons are for units and fixed fragments, not instructions."
},
"accessibility": [
"The prefix/suffix text is exposed to assistive technology alongside the field's label, so its meaning isn't lost for screen-reader users.",
"The editable portion remains a real, independently focusable input - the add-on segments are not part of the tab order since they aren't interactive.",
"Sufficient contrast between the add-on segment and the editable field, so the boundary between fixed and editable text is visually clear."
],
"relatedComponents": [
"Input",
"Select",
"Number"
]
}