clickworks
Works / Actions

Copier

Put the slip on the glass, by dragging it or with one click. The lid lifts, the lamp scans it and a toner copy slides into the tray. Taking the copy out puts the value on the clipboard. Every copy is a little different: an open-lid border, specks, a drum line, a hair off square.

Free15 files0 dependencies14.8 kB gzippedRenders on the serverKeyboard and screen reader

Install

npx shadcn@latest add https://clickworks.dev/r/copier.json

The files land in components/clickworks/copier/. No other packages are added.

Usage

import { Copier } from "@/components/clickworks/copier/react/Copier"

export function ContactEmail() {
  return <Copier value="hello@yourstudio.com" label="Email" theme="auto" style={{ width: 320 }} />
}

Props

value
string

Typed on the slip and copied to the clipboard. Long values condense to fit.

Default "hello@example.com"

label
string

Small printed label above the value.

Default "Email"

mark
string

Engraved on the lid. Empty hides it.

theme
"dark" | "light" | "auto"

Auto follows the page (its background, data-theme or dark class), then the device.

Default "dark"

accent
string

Start key, display and scan lamp.

Default "rgb(226, 72, 31)"

body / tray / paper / ink
string

Machine, tray, slip and type colours. Every shade is mixed from them.

light / dark
{ accent?, body?, tray?, paper?, ink?, shadow?, strength? }

Colours for one theme only. They win over the shared colours.

valueFont / labelFont
string

Any CSS font family. Nothing is downloaded: load the font on your page.

sound
boolean

The lid, motor, paper and the copied beep.

Default true

haptics
boolean

Small vibrations on phones.

Default true

copies
"stay" | "clear"

Copies stay where they're dropped, or slide away after copying.

Default "stay"

still
"rest" | "tray"

A frozen, non-interactive state for thumbnails.

Events

onCopied
(detail: { value }) => void

The value was put on the clipboard.

Styling

Size it like an image: set a width, a height or both, and it centres itself without stretching. Colours are props rather than CSS variables, because the machine mixes every shade, shadow and glow from them.

Behaviour and accessibility

  • The slip is a button: Enter or Space feeds it in. Each copy in the tray is a button too.
  • Drag the slip to the glass and the lid lifts. Dropped anywhere else, it slides back.
  • A polite live region announces each copy to screen readers.
  • With reduced motion the machine jumps between states instead of animating.

Files

react/Copier.tsxReact component
element/index.tsCustom element
element/copier-element.tsCustom element
core/machine.tsEngine
core/sheets.tsEngine
core/copies.tsEngine
core/display.tsEngine
core/textures.tsEngine
core/sound.tsEngine
core/palette.tsEngine
core/styles.tsEngine
core/color.tsEngine
core/fonts.tsEngine
core/layout.tsEngine
core/matrix.tsEngine