Skip to content

useClipboard

jsxhook

useClipboard: interact with the system clipboard

Installation

$ bunx termuijs add use-clipboard

Copies the source into src/components/use-clipboard/ and installs @termuijs/core, @termuijs/jsx.

Usage

ts
import { useClipboard } from '@termuijs/jsx'
ts
const { value, set, reset } = useClipboard({
  initial: undefined,
})

API Reference

useClipboard

PropTypeDefaultDescription
initialT | undefinedInitial value
persistbooleanfalsePersist to storage
keystringStorage key
#hook#use-clipboard