charton API / @chart-on/ui / index / CommandPalette
Interface: CommandPalette
Defined in: ui/src/command-palette.ts:43
The command palette made by createCommandPalette: open or close it, add entry sources, and turn it on or off.
Properties
enabled
readonlyenabled:boolean
Defined in: ui/src/command-palette.ts:46
False while turned off (the shell's commandPalette feature flag): it does not open, and its shortcut is free.
isOpen
readonlyisOpen:boolean
Defined in: ui/src/command-palette.ts:44
Methods
addSource()
addSource(
source): () =>void
Defined in: ui/src/command-palette.ts:52
Add a source of entries. Throws when its id is taken. Returns a function that removes it.
Parameters
source
Returns
() => void
close()
close():
void
Defined in: ui/src/command-palette.ts:50
Close and give focus back to where it was before opening.
Returns
void
destroy()
destroy():
void
Defined in: ui/src/command-palette.ts:55
Returns
void
open()
open(
query?):void
Defined in: ui/src/command-palette.ts:48
Open with query in the search box (empty by default); with the palette open, search for query.
Parameters
query?
string
Returns
void
setEnabled()
setEnabled(
on):void
Defined in: ui/src/command-palette.ts:54
Turn the palette on or off; turning it off closes it.
Parameters
on
boolean
Returns
void