Line

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

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

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

Functions#

useCommandPalette()#

useCommandPalette(): object

Defined in: ui/client/features/command-palette/hooks/useCommandPalette.tsx:13

Palette behaviour: the query filters the registered commands, arrows move, Enter runs, Esc closes.

Returns#

object

activeIndex

activeIndex: number = state.activeIndex

close

close: () => void

Returns

void

groups

groups: CommandGroup[]

onKeyDown

onKeyDown: (e) => void

Parameters
e
key

string

preventDefault

() => void

Returns

void

onQuery

onQuery: (query) => void

Parameters
query

string

Returns

void

open

open: boolean

query

query: string = state.query

run

run: (cmd) => void

Parameters
cmd

Command

Returns

void

setActiveIndex

setActiveIndex: (index) => void

Parameters
index

number

Returns

void