Skip to content

useModal

jsxhook

useModal: typed modal manager with queueing and cleanup

Installation

$ bunx termuijs add use-modal

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

Usage

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

API Reference

useModal

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