Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Copy Shortcut Kbd for Vue

The Ctrl C copy shortcut as two grouped caps. The hint is hard-coded, and this demo does not copy anything.

UI library: Ark UI

Ctrl and C sit in one group, spaced as a single chord. The letters are static. There is no copy handler.

Put this on a copy control, and show ⌘C for Mac. If people can also click, use a Button. In Vue, Ark UI does not write to the clipboard.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Kbd anatomy: kbd, group

Usage

<div class="rounded-md border bg-background p-4">
  <KbdGroup><Kbd>Ctrl</Kbd><Kbd>C</Kbd></KbdGroup>
</div>

FAQ

Why is Ctrl C the copy shortcut?

Apple's Lisa and Macintosh put cut, copy and paste on X, C and V, next to each other at the bottom left of the keyboard, where one hand reaches them with the modifier. Windows adopted the same letters with Ctrl, and they became the standard.

Is it Ctrl C everywhere or ⌘C on Mac?

Ctrl C on Windows, Linux and ChromeOS; ⌘C on macOS. Show the one that matches the user's platform, as the Platform-Aware Shortcut example does.

How do I customize what Ctrl C copies?

Listen to the copy event and set the data with event.clipboardData.setData before calling preventDefault. To copy from a button instead, call navigator.clipboard.writeText. Both are browser APIs and work the same in every framework.

Should a custom copy work everywhere or only in some places?

Only where there's something special to copy, such as a selected row in a data grid. Never take over copy in text fields: people expect it to copy their selection.

Should the app confirm a copy?

Native copy of selected text needs no feedback. A custom copy, like a Copy link button, should confirm it: a check icon on the button or a short toast saying Copied.

Is Ctrl C accessible to everyone?

Not to everyone: some people can't press two keys at once, and operating systems offer sticky keys for them. Always offer copy through a visible control or a menu as well, so the shortcut is only a faster way.

API Reference

Kbd

No extra props in this demo. The rest is on the Kbd page.