shadcn.io is an independent project built on shadcn/ui
Three actions that display a shortcut. Copy shows ⌘C, Save shows ⌘S, and Export shows ⌘E. In the row the key cap follows the label. In the vertical group the label is at the start and the cap is at the end. Pressing those keys does nothing.
Show the cap as a reminder for a shortcut you listen for yourself. If the keys matter and the button does not, a Kbd on its own is enough. In Solid, Ark UI does not bind ⌘C, ⌘S, or ⌘E.
Installation
Anatomy

Usage
<div class="flex flex-col gap-4">
<ButtonGroup aria-label="File actions">
<Button size="sm" variant="outline">
<CopyIcon aria-hidden="true" data-icon="inline-start" />
Copy
<Kbd class="ms-2">⌘C</Kbd>
</Button>
<Button size="sm" variant="outline">
<SaveIcon aria-hidden="true" data-icon="inline-start" />
Save
<Kbd class="ms-2">⌘S</Kbd>
</Button>
<Button size="sm" variant="outline">
<DownloadIcon aria-hidden="true" data-icon="inline-start" />
Export
<Kbd class="ms-2">⌘E</Kbd>
</Button>
</ButtonGroup>
<ButtonGroup aria-label="File actions" orientation="vertical">
<Button class="justify-between" size="sm" variant="outline">
<span class="flex items-center gap-2">
<CopyIcon aria-hidden="true" />
Copy
</span>
<Kbd>⌘C</Kbd>
</Button>
<Button class="justify-between" size="sm" variant="outline">
<span class="flex items-center gap-2">
<SaveIcon aria-hidden="true" />
Save
</span>
{/* The rest of the file is under Installation. */}FAQ
Does pressing ⌘C trigger Copy?
No. Kbd only draws the keys. Register the shortcut in your own key handler and run the same action as the button.
How is the key cap spaced in the row?
It has ms-2, a margin on the start side, so it keeps its distance from the label in either reading direction.
How does the vertical group push the cap to the end?
Each button has justify-between. The icon and label are wrapped in one span, so there are two children and the cap goes to the far side.
Are the shortcuts announced?
Yes. The cap's text is inside the button, so Copy is read with ⌘C. Use aria-keyshortcuts on the button if you want assistive tech to know the shortcut too.
API Reference
Button Group
Sets aria-label="File actions" and orientation="vertical". The rest is on the Button Group page.
Button
Sets size="sm" and variant="outline". The rest is on the Button page.
Kbd
No extra props in this demo. The rest is on the Kbd page.





