useModal
Creates modal open/close state and focus-transfer actions
import { useModal } from "@roku-sdk/navigation";useModal(focusId: object): UseModalResultDescription
Creates modal open/close state and focus-transfer actions.
Parameters
| Name | Type | Description |
|---|---|---|
focusId | object | Optional pre-created focus identity. When omitted, one is generated and returned. Pass the same object to <ModalBoundary focusId>. |
Return values
Returns UseModalResult.
Types
UseModalResult
The state and actions returned by useModal.
| Name | Type | Description |
|---|---|---|
close | () => void | Close the modal: clear show. Focus falls back via boundary unregister. |
focusId | object | Stable focus identity shared with ModalBoundary. Pass to <ModalBoundary focusId={...} />. open() targets this id with setFocus. |
isOpen | Accessor<boolean> | Reactive accessor for whether the modal is open. Wire to <ModalBoundary show={...} />. |
open | () => void | Open the modal: set show true and transfer focus to the modal boundary. |
Updated about 3 hours ago
What’s Next
Did this page help you?