Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Kbd examples · Shortcut

Copy Shortcut Kbd for React

The Ctrl C copy shortcut as a key group.

Framework
UI library

Copy is the shortcut nearly everyone knows. This React example shows it as Ctrl and C in a KbdGroup, which spaces the two caps evenly and marks them as one shortcut. Use it in context menus, copy buttons and help pages, and show ⌘C instead to Mac users.

Preview

Preview width
CtrlC

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 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.