Skip to main content

useSearchModal()

Home > @backstage/plugin-search > useSearchModal

Use this hook to manage the state of SearchModal and change its visibility. Monitors route changes setting the hidden state to avoid having to call toggleModal on every result click.

Signature:

function useSearchModal(initialState?: boolean): SearchModalValue;

Parameters

ParameterTypeDescription
initialStateboolean(Optional) pass true to make the modal initially visible

Returns:

SearchModalValue

an object containing the state of the modal together with functions for changing the visibility of the modal.