Use disclosure

GitHub

React hook for controlling boolean disclosure state with open, close, and toggle helpers.

Installation

bash
pnpm dlx shadcn@latest add @cs/use-disclosure

Usage

tsx
import { useDisclosure } from "@/hooks/cs/use-disclosure"
tsx
const [opened, { open, close, toggle }] = useDisclosure()

API Reference

UseDisclosureReturnValue

tsx
type UseDisclosureReturnValue = [boolean, UseDisclosureHandlers]

useDisclosure

Manages a boolean disclosure state with open, close, and toggle helpers.

Parameters

NameTypeDefaultDescription
initialState *boolean--
options *UseDisclosureOptions--

Returns: UseDisclosureReturnValue