Skip to content

No.45 · Buttons

Command Pill

An install command you can copy: the pill types itself once on arrival, and clicking lifts the command out as the word Copied rises in behind it.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Build a copyable install-command pill: a 46px dark rounded rectangle with a muted prompt glyph ($), the command in Geist Mono, and a small copy well on the right. When it first scrolls 60% into view, the command types itself once (38ms per character) with a block caret; the untyped remainder is reserved as invisible text so the pill never changes width. Clicking copies to the clipboard: the command lifts up and out of a one-line window while 'Copied to clipboard' rises into its place in green (480ms expo-out), and the copy glyph shrinks away as a green check scales in; after 1.6s it all settles back. Hover strengthens the hairline; press compresses to 0.985. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click (or Enter/Space) to copy; the confirmation replaces the command for 1.6s. Motion: One-time typing on first view; 480ms vertical exchange of command and confirmation; icon morph 380ms. Accessibility: A button labelled 'Copy command: …'; the visual text is aria-hidden; 'Copied' is announced. Reduced motion skips typing and makes the exchange instant. Responsive behavior: Shrinks to its container; long commands clip inside the window. Touch: Tap to copy. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Click (or Enter/Space) to copy; the confirmation replaces the command for 1.6s.
Motion
One-time typing on first view; 480ms vertical exchange of command and confirmation; icon morph 380ms.
Accessibility
A button labelled 'Copy command: …'; the visual text is aria-hidden; 'Copied' is announced. Reduced motion skips typing and makes the exchange instant.
Responsive
Shrinks to its container; long commands clip inside the window.
On touch
Tap to copy.