Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Button Group examples · Forms

Priority Selector Button Group for React

A priority picker with Low, Medium, High and Urgent, and P1 to P4 buttons that share one selection.

Framework
UI library

The priority field on a task or issue form. Words in the first row, codes in the second, both writing one value that starts at Medium. The selected button is filled and announced as 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

How is the priority tracked?

One value, starting at medium. Each button carries its own value, and pressing it stores that value. The matching button gets variant="default" and aria-pressed.

Do the two rows share a selection?

Yes. Picking P2 clears Medium. Keep only the row your team uses, or map P1 to Urgent and so on.

Can Urgent be red?

Yes. Set that button's variant to destructive when it's selected. The demo uses the same fill for every level so the row stays even.

How do I submit the choice with a form?

Put a hidden input with the value in the form, or read it in your submit handler. The buttons have type="button", so pressing one doesn't submit.

Is this a radio group?

No. These are buttons with aria-pressed. A Radio Group or a Toggle Group gives one tab stop and Arrow key movement if you need them.

What size are the buttons?

All use size="sm", and outline when not selected.