shadcn.io is not affiliated with official shadcn/ui
Input Group examples · Icons
Dual Icons Input Group for React
A card number and a password input, each with an icon at both ends.
An icon on each side of a field: the start one says what the field is, the end one adds a cue. The card field has a card and a lock, the password field a lock and a help circle. Both addons come after the input in the code; align places them.
Preview
Installation
FAQ
How do two addons land on both sides?
The first keeps the default inline-start, the second sets align="inline-end". Both are written after the input.
How is the card number field set up?
type="text" with inputMode="numeric", which brings up the number pad without the quirks of type="number". Add autoComplete="cc-number" in a real checkout.
Are the icons buttons?
No, they're decorative and aria-hidden. To make the help circle open help, use a button, as in Help Tooltips.
Related
- Search with Icon Input GroupA search input with a magnifying glass at
- Contact Fields with Icons Input GroupEmail and phone inputs, each with an icon
- Multiple Icons Input GroupA password and an API key input with two
- Password with Toggle InputA password field with a button that shows
- Currency InputAn amount field with a dollar sign inside
- Input with LabelA text input with a label above it