shadcn.io is not affiliated with official shadcn/ui
Quick Actions Dialog Block for React
An invoicing app's quick-actions dialog shown open: eight action tiles in two columns, a star on each that pins it into one of four slots at the top, arrow keys across the tiles and a letter that runs an action.
Installation
Overview
Put the actions people use most one press away, with this quick-actions dialog for React with Base UI. It opens from the Overview page of Ledgerbarn, an invoicing app: the page's header holds an outline New Button, and the dashboard, a top bar, three figures and a list of recent activity, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The dialog is the opposite of a palette: no search box and no list to filter, just a board of eight tiles in two columns, each an icon, a name and, where the action has a real key, a Kbd with its letter. A star on every tile pins that action into one of four Pinned slots at the top, so the order is yours; an empty slot keeps its place. The arrow keys move across the tiles and their stars in two directions, Enter or a press runs the action, and so does its letter. Running one closes the dialog and the drawn Recent activity gains a line such as "Invoice drafted in this demo". There is no filled button: the tiles are the actions. For preview the dialog is drawn open in place when the page loads; the New button opens the real Dialog, with the same board and the same pins. For dashboards, editors and any app with a handful of things people do daily.
FAQ
Why is the dialog already open, and what do I keep?
So you can see it without a click. On load the dialog is a copy drawn in place over the dashboard: a native dialog element that isn't modal, so nothing is trapped, hidden or focused, and the page around the preview keeps working. The New button opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same ActionBoard component and share the block's state, so what you pinned in the copy is pinned in the real one. In your app keep the Dialog and drop the copy: the "in-place" state, the scrim and the dialog element inside the frame.
How is this different from a command palette?
A palette is for finding: you type, a list filters and Enter runs the first match. This is for the few things you do every day, so there is no input and nothing to search; the list is short enough to see whole, and the star lets each person put their own first. If you also need search across hundreds of commands, keep a palette for that and use this board for the pinned few.
How do pins work, and how many are there?
The star on a tile pins its action into the first free slot of four; press it again to unpin. The pinned chips run their action too, and a polite message says what changed, "Pinned New invoice. 3 of 4 slots used.", or that all four are taken and one has to go first. Pins live in the block's state for the visit. In your app save them per person (pinned is a list of action ids) and read them back when the board opens.
Is it accessible from the keyboard?
Yes. The whole board, the pinned chips, the tiles and the stars, is one tab stop, so Tab passes through it in one press. Inside, the arrow keys move in two dimensions (Left and Right follow the page's direction), Home and End go to the ends of a row, and Enter or Space presses the cell. A letter shown on a tile runs that action while focus is on the board, and each such tile carries it as its keyboard shortcut. The real dialog is named by its title and described by its sentence, and Escape, the close button and running an action return focus to New. The trigger is passed to DialogTrigger through render, and the dialog is controlled with open and onOpenChange. The copy shown on load moves no focus; Escape inside it and its close button close it and put focus on the button.
What stays local in the demo, and how do I wire it up?
All of it. Running an action creates nothing: it adds a line to the drawn Recent activity and says in a polite message that nothing was created, sent or saved. In your app give each entry in ACTIONS a real handler (open the invoice form, start the import), keep the done sentence only if you want an activity feed, and let your router or modal layer take over after run closes the board.
How does it look on a phone?
The copy shown on load docks to the foot of the page as a bottom sheet with the board scrolling inside it. The tiles stay two across, the key hints are hidden because a phone has no keyboard to use them, and the four pinned slots become two rows of two. The real dialog keeps the Dialog's own phone layout: a sheet stuck to the bottom of the screen.
Related
- Pro
Command Palette Dialog
Pickers and searchA docs workspace's command palette shown open over its page: Recent and Pages when the field is empty, and a typed greater-than, at or hash turns it to Actions, People or Pages, each with its own groups and count, and each choice edits the drawn page.
- Pro
Actions Command Menu
Actions and keysA signing tool's document with its actions menu shown open: nine actions in four groups, a key on the five that change the document that runs them while the menu is open, and a drawn lease whose badge and signature follow.
- Pro
Select Template Dialog
Pickers and searchA documents app's new-document dialog shown open: six icon tiles in two columns that move with the arrow keys and jump on a typed letter, Popular and New badges, a Create button that names the choice, and the new file landing on the home.
- Pro
Quick Actions Sandbox Onboarding
ChecklistsA document workspace's first four moves as a sandbox panel: four rows with Try and Undo buttons beside a small drawn workspace that adds a document, a teammate, a connected app and a reminder.
- Pro
Add to Cart Dialog
Payments and plansA stool shop's product page with its add-to-cart dialog shown open: two heights that redraw the stool and move the price, three finishes with a sentence each, a quantity that stops at the stock left, and a total that follows the choices.
- 12Pro
Sort Options Dialog
Notes and editingA data-grid tool's sort dialog shown open: up to three rules with a field and a direction each, Move up, Move down and Remove, a sorted five-row preview with the sorted columns numbered, and the table re-sorting on apply.