Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/client/features/command-palette/hooks/useCommandRegistry

Cockpit client (features), next. Source: ui/client/features/command-palette/hooks/useCommandRegistry.tsx.

Type Aliases#

RegistryApi#

RegistryApi = object

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:7

Properties#

commands

commands: Command[]

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:8

open

open: boolean

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:9

register

register: (commands) => void

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:11

Parameters
commands

Command[]

Returns

void

setOpen

setOpen: (open) => void

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:10

Parameters
open

boolean

Returns

void

unregister

unregister: (ids) => void

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:12

Parameters
ids

string[]

Returns

void

Variables#

RegistryContext#

const RegistryContext: Context<RegistryApi | null>

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:16

Functions#

CommandRegistryProvider()#

CommandRegistryProvider(__namedParameters): FunctionComponentElement<ProviderProps<RegistryApi | null>>

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:20

Holds the registered commands and whether the palette is open. Mount once (the shell does); features then call useRegisterCommands.

Parameters#

__namedParameters
children

ReactNode

Returns#

FunctionComponentElement<ProviderProps<RegistryApi | null>>


useCommandRegistry()#

useCommandRegistry(): object

Defined in: ui/client/features/command-palette/hooks/useCommandRegistry.tsx:30

Registered commands and the open state (empty/no-op outside the provider).

Returns#

object

commands

commands: Command[]

open

open: boolean

setOpen

setOpen: (open) => void

Parameters
open

boolean

Returns

void