Skip to content

useBoolean

jsxhook

useBoolean component

Installation

$ bunx termuijs add use-boolean

Copies the source into src/components/use-boolean/ and installs @termuijs/jsx.

Usage

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

API Reference

useBoolean

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