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 playgroundAbout
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
npm i @ashutoshswamy/smouiUsage
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
More buttons components
- AddButtonAdd + that opens into a stepper in place. The plus never moves, so a second tap lands where the first did. At one the minus becomes a bin; hold to repeat.
- AddToBagOne pill that is the add button until pressed, then grows a stepper in place. Step back to zero and it folds up again.
- ArrowButtonOn hover the arrow exits right as a second one enters from the left, and the chip swells.
- CopyButtonCopies text, then swaps its label for a drawn checkmark.
- FillButtonThe fill floods in from the edge your pointer entered and drains out through the edge it left by.
- FollowButtonFollow becomes Following and the pill resizes to fit. Point at Following and it offers Unfollow in red.