useModal

Creates modal open/close state and focus-transfer actions

import { useModal } from "@roku-sdk/navigation";
useModal(focusId: object): UseModalResult

Description

Creates modal open/close state and focus-transfer actions.

Parameters

NameTypeDescription
focusIdobjectOptional 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.

NameTypeDescription
close() => voidClose the modal: clear show. Focus falls back via boundary unregister.
focusIdobjectStable focus identity shared with ModalBoundary. Pass to <ModalBoundary focusId={...} />. open() targets this id with setFocus.
isOpenAccessor<boolean>Reactive accessor for whether the modal is open. Wire to <ModalBoundary show={...} />.
open() => voidOpen the modal: set show true and transfer focus to the modal boundary.

What’s Next

Did this page help you?