useDialogTriggerState
Manages state for a dialog trigger. Tracks whether the dialog is open, and provides methods to toggle this state.
install | yarn add @react-stately/dialog |
---|---|
version | 3.0.0-alpha.1 |
usage | import {useDialogTriggerState} from '@react-stately/dialog' |
API#
useDialogTriggerState(props: DialogTriggerProps): DialogTriggerState
Interface#
Properties
Name | Type | Description |
isOpen | boolean | Whether the dialog is currently open. |
setOpen | (value: boolean) => void | Sets whether the dialog is open. |
Methods
Method | Description |
open(): void | Opens the dialog. |
close(): void | Closes the dialog. |
toggle(): void | Toggles the dialog's visibility. |
Name | Type | Description |
isOpen | boolean | Whether the Dialog is open by default (controlled). |
defaultOpen | boolean | Whether the Dialog is open by default (uncontrolled). |
onOpenChange | (isOpen: boolean) => void | Handler that is called when the Dialog's open state changes. |
Properties
Name | Type | Description |
isOpen | boolean | Whether the dialog is currently open. |
setOpen | (value: boolean) => void | Sets whether the dialog is open. |
Methods
Method | Description |
open(): void | Opens the dialog. |
close(): void | Closes the dialog. |
toggle(): void | Toggles the dialog's visibility. |