Copy

Displays a tooltipped button that puts string contents into the user's clipboard.

Was this example helpful?

Usage#


Code
import { Copy } from "@medusajs/ui"
Code
<Copy content="yarn add @medusajs/ui" />

API Reference#


This component is based on the button element and supports all of its props

PropTypeDefault
content
string
-
variant
"mini"
|"default"
|null
"default"
asChild
boolean
false
Was this page helpful?

Usage Outside Medusa Admin#


If you're using the Copy component in a project other than the Medusa Admin, make sure to include the TooltipProvider somewhere up in your component tree, as the Copy component uses a Tooltip:

Code
1<TooltipProvider>2  <Copy content="yarn add @medusajs/ui" />3</TooltipProvider>

Examples#


With custom display#

Was this example helpful?

As child#

Using the asChild prop, you can render the <Copy/> as it's child. This is useful if you want to render a custom button, to prevent rendering a button inside a button.

Copy command

Was this example helpful?