Skip to main content
Version: Next

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

Parameter

Type

Description

initialState

boolean

(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.