Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Input Group examples · Buttons

Multiple Action Buttons Input Group for React

A read-only link with an info button and a favorite button that fills its heart when pressed.

Framework
UI library

Two actions at the end of one field. Each is its own inline-end InputGroupAddon after the input: an info button and a favorite button whose heart fills when it's on. The favorite button reports its state with aria-pressed.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

FAQ

Why are the two buttons in separate addons?

Each InputGroupAddon with align="inline-end" is placed after the input, in source order, so two addons line up at the end. One addon holding both buttons works too.

How does the heart fill?

A favorited flag toggles on each press, and the icon gets fill-current while it's on, so the heart fills with the text color.

How do screen readers know the favorite is on?

The button sets aria-pressed from the same flag, so it's announced as a toggle button, pressed or not pressed. Its name stays Favorite.

What does the info button do?

Nothing in the demo. Open a Tooltip or a Popover from it, as in API Key Info.

Why is the input read-only?

It shows a link to act on, not to edit. readOnly keeps it focusable and selectable.

How are the icon buttons named?

Each InputGroupButton has an aria-label, Info and Favorite, and the icons are aria-hidden.