CopyCommand

A command line with a Copy button. The icon turns to a check, the word rolls to Copied and the button grows to fit. Buttons.

Open playground
$ npm i @ashutoshswamy/smoui

About

CopyCommand is a React component in the Buttons category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { CopyCommand } from "@ashutoshswamy/smoui" and set command, prompt, onCopy.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { CopyCommand } from "@ashutoshswamy/smoui";

<CopyCommand command="npm i @ashutoshswamy/smoui" />

Props 3

command

Text shown and copied.

string
prompt

Dimmed prefix. Not copied.

stringdefault "$"
onCopy

Called after copying.

() => void