Skip to main content

SearchModalProvider()

Home > @backstage/plugin-search > SearchModalProvider

A context provider responsible for storing and managing state related to the search modal.

Signature:

SearchModalProvider: (props: SearchModalProviderProps) => React.JSX.Element

Parameters

Parameter

Type

Description

props

SearchModalProviderProps

**Returns:**

React.JSX.Element

Remarks

If you need to control visibility of the search toggle outside of the modal itself, you can optionally place this higher up in the react tree where your custom code and the search modal share the same context.

Example

import {
SearchModalProvider,
SidebarSearchModal,
} from '@backstage/plugin-search';

// ...

<SearchModalProvider>
<KeyboardShortcutSearchToggler />
<SidebarSearchModal>
{({ toggleModal }) => <SearchModal toggleModal={toggleModal} />}
</SidebarSearchModal>
</SearchModalProvider>