Skip to content

zidane-ui/palette

import { … } from 'zidane-ui/palette'ui/src/palette/index.ts

Components#

CommandPaletteComponent#

Renders the command palette: sources, levels and running from controller, the surface from PalettePanel.

TypeScript
function CommandPalette(props: CommandPaletteProps): Element
Parameters
NameTypeDescription
propsCommandPaletteProps

CommandPaletteProps.

Element
CommandPalette props
NameTypeDescription
busy?boolean

Turns the header spinner while the app's own search is out.

controllerPaletteController

The palette's state, from usePaletteController.

extraGroups?readonly PaletteSection<PaletteItem>[]

Groups shown after the ranked ones, never reordering them. Keep the array stable.

ui/src/palette/CommandPalette.tsx:32

PaletteDialogComponent#

Renders the palette surface in the modal slot usePaletteModalSlot opened. Esc and the backdrop tell the palette; the palette closing (Cmd+K again, an item ran) closes the slot.

TypeScript
function PaletteDialog(props: PaletteDialogProps): Element
Parameters
NameTypeDescription
propsPaletteDialogProps

PaletteDialogProps.

Element
PaletteDialog props
NameTypeDescription
archive?'all' | 'active' | 'archived'

Which sessions sessions was loaded with.

className?string

Classes merged on the surface's root.

contextPaletteContext

The snapshot handed to every source. Keep it stable while nothing in it changed.

onInsert?(text: string) => void

Receives an insert result's text.

onPrompt?(text: string) => void

Receives a prompt result's text.

rows?PaletteRows

The app rows, from createPaletteRows (module scope). Absent: the surface's default rows.

sessions?readonly PaletteSession[]

Every loaded session, for the matches inside conversations. Absent: no "In conversations" group.

style?CSSProperties

Inline styles on the surface's root.

ui/src/palette/PaletteDialog.tsx:62

PaletteProviderComponent#

Holds the palette's state (open, sources, recents) for the components below it.

TypeScript
function PaletteProvider(props: PaletteProviderProps): Element
Parameters
NameTypeDescription
propsPaletteProviderProps

The host, optional labels and createRankWorker, and the children.

Element
PaletteProvider props
NameTypeDescription
childrenReactNode

The app's components.

createRankWorker?() => Worker

Starts a worker running zidane-ui/palette/rank.worker, so a big catalog (a project's files) is ranked off the main thread. Without one, every query ranks in place.

host?PaletteHost

The data the built-in sources read and where recents persist. Read once, at mount.

labels?Partial<{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }>

Overrides for the palette area's strings. Keys you leave out keep the default English label.

ui/src/palette/PaletteProvider.tsx:72

Functions#

createPaletteRowsFunction#

Builds the palette's app rows over what the app knows about its sessions. Call it once, at module scope: the hooks it is handed run inside the rows.

TypeScript
function createPaletteRows(options?: PaletteRowsOptions): PaletteRows
Parameters
NameTypeDefaultDescription
options?PaletteRowsOptions{}

PaletteRowsOptions.

ui/src/palette/PaletteRows.tsx:117

paletteVerbOfFunction#

What Enter does to a session, a conversation match or a file; the surface names the rest.

TypeScript
function paletteVerbOf(
  row: PaletteRowData<PaletteItem>,
  labels: { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string },
): string | undefined
Parameters
NameTypeDescription
rowPaletteRowData<PaletteItem>

The row under the cursor.

labels{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }

The palette labels.

string | undefined

ui/src/palette/PaletteRows.tsx:84

useActionsPaletteSourceFunction#

Registers the key command registry's actions as a palette source. Registers again only when the set of bound actions changes: the rows run the handlers in effect when picked.

TypeScript
function useActionsPaletteSource(): void

ui/src/palette/app-sources.ts:27

useConversationHitFunction#

The content hit behind a palette row, if it is one.

TypeScript
function useConversationHit(itemId: string): PaletteConversationHit | undefined
Parameters
NameTypeDescription
itemIdstring

The row's item id.

ui/src/palette/useConversationSearch.ts:113

useConversationSearchFunction#

Searches inside conversations as the query settles. Nothing (and no request) when the host leaves searchConversations out.

TypeScript
function useConversationSearch(
  query: string,
  options: ConversationSearchOptions,
): ConversationSearch
Parameters
NameTypeDescription
querystring

The palette's query as typed.

optionsConversationSearchOptions

ConversationSearchOptions.

ui/src/palette/useConversationSearch.ts:53

usePaletteFunction#

The palette's state and actions. Re-renders on every state change. Throws outside a PaletteProvider.

TypeScript
function usePalette(): PaletteApi

ui/src/palette/PaletteProvider.tsx:101

usePaletteActionsFunction#

The palette's stable actions. Never re-renders its caller. Throws outside a PaletteProvider.

TypeScript
function usePaletteActions(): PaletteActions

ui/src/palette/PaletteProvider.tsx:108

usePaletteControllerFunction#

The command palette's state: gather, rank, levels and running. Call it inside a PaletteProvider.

TypeScript
function usePaletteController(options: PaletteControllerOptions): PaletteController
Parameters
NameTypeDescription
optionsPaletteControllerOptions

The context and where agent-bound results go.

ui/src/palette/usePaletteController.ts:115

usePaletteHostFunction#

The PaletteHost given to the nearest PaletteProvider, if any.

TypeScript
function usePaletteHost(): PaletteHost | undefined
PaletteHost | undefined

ui/src/palette/PaletteProvider.tsx:115

usePaletteLabelsFunction#

The palette area's strings, with the provider's overrides.

TypeScript
function usePaletteLabels(): { paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }
{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }

ui/src/palette/PaletteProvider.tsx:120

usePaletteModalSlotFunction#

Opens the palette surface in the modal slot while the palette is open, and closes the palette when another modal takes the slot. Mount it once, under ModalProvider and PaletteProvider.

TypeScript
function usePaletteModalSlot(options: PaletteModalSlotOptions): void
Parameters
NameTypeDescription
optionsPaletteModalSlotOptions

PaletteModalSlotOptions.

ui/src/palette/PaletteDialog.tsx:159

usePaletteSourceFunction#

Registers a source for the component's lifetime. source is read through a ref, so callers can pass a fresh object every render without churning the registry; it registers again only when its id changes. null registers nothing.

TypeScript
function usePaletteSource(source: PaletteProvider | null): void
Parameters
NameTypeDescription
sourcePaletteProvider | null

The source, or null.

ui/src/palette/PaletteProvider.tsx:132

useRankedItemsFunction#

Ranks items for query, off the main thread for a big catalog when the provider has a rank worker.

TypeScript
function useRankedItems(
  items: readonly PaletteItem[],
  query: string,
  recents: readonly string[],
): RankedItems
Parameters
NameTypeDescription
itemsreadonly PaletteItem[]

The catalog.

querystring

The query.

recentsreadonly string[]

Recently run ids, for the empty-query order.

ui/src/palette/useRankedItems.ts:67

useSessionRankFunction#

A session's palette rank: 0 when it needs the user (attention, a pending approval or question), 1 while it runs, else 2.

TypeScript
function useSessionRank(
  peekRunning: (sessionId: string) => boolean,
): (sessionId: string) => SessionRank
Parameters
NameTypeDescription
peekRunning(sessionId: string) => boolean

Whether the app sees the session running now (read when ranking, not subscribed).

(sessionId: string) => SessionRank

ui/src/palette/app-sources.ts:48

Constants#

CONVERSATION_SEARCH_MIN_CHARSConstant#

Shorter queries match nearly every conversation: not worth a scan.

TypeScript
const CONVERSATION_SEARCH_MIN_CHARS = 2

ui/src/palette/useConversationSearch.ts:20

ConversationHitsContextConstant#

The hits of the rows on show, for the rows that render them.

TypeScript
const ConversationHitsContext: Context<ReadonlyMap<string, PaletteConversationHit>>

ui/src/palette/useConversationSearch.ts:106

PALETTE_MODAL_IDConstant#

The palette's modal-slot id (modal.open({ id })), shared by the slot bridge and the surface.

TypeScript
const PALETTE_MODAL_ID = 'palette'

ui/src/palette/PaletteDialog.tsx:32

Interfaces#

ConversationSearchInterface#

What useConversationSearch returns.

TypeScript
interface ConversationSearch
ConversationSearch properties
NameTypeDescription
hitsReadonlyMap<string, PaletteConversationHit>

Each row's hit, by item id (match count, age).

rowsreadonly RankedPaletteItem[]

The "In conversations" rows, in the host's order.

searchingboolean

A scan for the current query is on its way.

ui/src/palette/useConversationSearch.ts:23

ConversationSearchOptionsInterface#

Options of useConversationSearch.

TypeScript
interface ConversationSearchOptions
ConversationSearchOptions properties
NameTypeDescription
archive?'all' | 'active' | 'archived'

Which sessions sessions was loaded with.

enabledboolean

False in a nested picker: content search is a root-level thing.

listedReadonlySet<string>

Session ids the ranked rows already show.

sessionsreadonly PaletteSession[]

Every loaded session.

ui/src/palette/useConversationSearch.ts:35

PaletteActionsInterface#

What never changes: callers that only open the palette or register a source never re-render with it.

TypeScript
interface PaletteActions
PaletteActions properties
NameTypeDescription
close() => void

Closes the palette.

open() => void

Opens the palette.

registerSource(source: PaletteProvider) => () => void

Registers a source for as long as the caller wants it; returns the unregister.

toggle() => void

Opens a closed palette, closes an open one (the Cmd+K entry point).

ui/src/palette/PaletteProvider.tsx:31

PaletteApiInterface#

The palette's state and actions, from usePalette.

TypeScript
interface PaletteApi extends PaletteActions, PaletteState
PaletteApi properties
NameTypeDescription
closefrom PaletteActions() => void

Closes the palette.

isOpenfrom PaletteStateboolean

Whether the palette is open.

markRecent(id: string) => void

Puts an item id first in the recents.

openfrom PaletteActions() => void

Opens the palette.

recentsfrom PaletteStatereadonly string[]

Recently run item ids, most recent first.

registerSourcefrom PaletteActions(source: PaletteProvider) => () => void

Registers a source for as long as the caller wants it; returns the unregister.

sourcesfrom PaletteStatereadonly PaletteProvider[]

Every registered source, in registration order.

togglefrom PaletteActions() => void

Opens a closed palette, closes an open one (the Cmd+K entry point).

versionfrom PaletteStatenumber

Bumps whenever an open palette's source signalled a change through subscribe.

ui/src/palette/PaletteProvider.tsx:43

PaletteContextInterface#

JSON-safe snapshot of the host handed to providers. Never holds functions.

TypeScript
interface PaletteContext
PaletteContext properties
NameTypeDescription
busy?boolean

A run is in flight on the active session.

cwd?string

Working directory of the active session.

hostPaletteHost

Which app is asking.

sessionId?string

Id of the active session.

dist/index-Bq87OcGy.d.ts:28132

PaletteControllerInterface#

The palette's state and handlers, for CommandPalette.

TypeScript
interface PaletteController
PaletteController properties
NameTypeDescription
back() => void

Leaves the nested level. Stable.

clearScope() => void

Searches every section again. Stable.

close() => void

Closes the palette.

cursornumber

The highlighted row's index.

cycleScope() => void

Scopes the root search to the next section; after the last, back to every section. Stable while scopes holds.

inputRefRefObject<HTMLInputElement | null>

The query field (focused again when a level opens).

loadingboolean

The root items have not landed yet.

nestedboolean

Whether a picker's level is shown.

noticePaletteNotice | null

The notice line (a notify result or a failed run).

placeholderstring | undefined

The query field's placeholder.

querystring

The query typed.

rankedreadonly RankedPaletteItem[]

The ranked rows of the current level.

run(row: PaletteRowData<PaletteItem>) => void

Runs a row. Stable.

runningboolean

A row is running.

scopestring | null

The section the root search is scoped to; null searches every section.

scopesreadonly string[]

The sections a scope can be: the root items' groups in order, then extraScopes.

sectionsreadonly PaletteGroup[]

ranked grouped into sections.

setCursor(index: number) => void

Moves the highlight.

setQuery(query: string) => void

Sets the query.

settledboolean

The rows are for the query typed.

titlestring | undefined

The nested level's title.

ui/src/palette/usePaletteController.ts:65

PaletteControllerOptionsInterface#

Options of usePaletteController.

TypeScript
interface PaletteControllerOptions
PaletteControllerOptions properties
NameTypeDescription
contextPaletteContext

The snapshot handed to every source. Keep it stable while nothing in it changed.

extraScopes?readonly string[]

Sections the app lists itself (its own groups), offered as scopes after the root items' groups. Keep it stable.

onInsert?(text: string) => void

Receives an insert result's text (the palette closes first).

onPrompt?(text: string) => void

Receives a prompt result's text (the palette closes first).

recentIdOf?(item: PaletteItem) => string

The id Recent remembers for a run root item. Default: the item's own id.

ui/src/palette/usePaletteController.ts:51

PaletteDialogPropsInterface#

Props for PaletteDialog.

TypeScript
interface PaletteDialogProps
PaletteDialogProps properties
NameTypeDescription
archive?'all' | 'active' | 'archived'

Which sessions sessions was loaded with.

className?string

Classes merged on the surface's root.

contextPaletteContext

The snapshot handed to every source. Keep it stable while nothing in it changed.

onInsert?(text: string) => void

Receives an insert result's text.

onPrompt?(text: string) => void

Receives a prompt result's text.

rows?PaletteRows

The app rows, from createPaletteRows (module scope). Absent: the surface's default rows.

sessions?readonly PaletteSession[]

Every loaded session, for the matches inside conversations. Absent: no "In conversations" group.

style?CSSProperties

Inline styles on the surface's root.

ui/src/palette/PaletteDialog.tsx:37

PaletteItemInterface#

An entry in the command palette.

TypeScript
interface PaletteItem
PaletteItem properties
NameTypeDescription
checked?boolean

For toggle items.

description?string

Secondary text shown beside the title.

disabled?string

Reason the item cannot run right now; it stays listed, muted.

groupstring

Section header. Hosts order groups by first appearance after Recent.

icon?PanelIcon

Icon for each renderer.

idstring

Stable, unique across providers: builtin:openSettings, slash:compact, <extension>/<id>.

keybinding?string

Resolved chord spec (ctrl+shift+k); the host formats it for display.

keywords?readonly string[]

Extra search terms not shown in the row.

kind?PaletteItemKind

How the item behaves. Treated as action when omitted.

searchOnly?boolean

Only appears once the query matches it: bulk catalogs (every file in the project) stay out of the empty-query listing but are one keystroke away.

sourcestring

Provider that owns run for this item. Stamped by the aggregator.

titlestring

Text shown in the row.

dist/index-Bq87OcGy.d.ts:28101

PaletteModalSlotOptionsInterface#

Options of usePaletteModalSlot.

TypeScript
interface PaletteModalSlotOptions
PaletteModalSlotOptions properties
NameTypeDescription
contextPaletteContext

The snapshot the surface opens with (reopening picks up a new one).

cwd?string

The project folder: the extension providers' live updates stay on for it while open.

render(context: PaletteContext) => ReactNode

The surface, usually a PaletteDialog.

ui/src/palette/PaletteDialog.tsx:144

PaletteProviderPropsInterface#

Props for PaletteProvider.

TypeScript
interface PaletteProviderProps
PaletteProviderProps properties
NameTypeDescription
childrenReactNode

The app's components.

createRankWorker?() => Worker

Starts a worker running zidane-ui/palette/rank.worker, so a big catalog (a project's files) is ranked off the main thread. Without one, every query ranks in place.

host?PaletteHost

The data the built-in sources read and where recents persist. Read once, at mount.

labels?Partial<{ paletteActionTitles: Record<string, string>; paletteAppearanceMode: Record<'dark' | 'light' | 'system', string>; paletteAppearanceModeHint: string; paletteAppearanceSettings: string; paletteCloseSidePanel: string; paletteCodeCompletion: string; paletteCommandGone: string; paletteCommandsGroup: string; paletteCompactTranscript: string; paletteCompactTranscriptHint: string; paletteConversationsGroup: string; paletteDiagnostics: Record<'off' | 'lsp' | 'tools', string>; paletteDiagnosticsHint: string; paletteEditFiles: string; paletteEditorGroup: string; paletteEditorSettings: string; paletteFileCount: (count: number) => string; paletteFilesGroup: string; paletteFilesPlaceholder: string; paletteFilesTitle: string; paletteFilesTreeSide: Record<'right' | 'left', string>; paletteFilesTreeSideHint: string; paletteGoToFile: string; paletteHoverDocs: string; paletteImportRepo: string; paletteImportRepoHint: string; paletteMatchCount: (count: number) => string; paletteModelGroup: string; paletteNavigateGroup: string; paletteNeedsLsp: string; paletteNeedsSession: string; paletteOpenAndFind: string; paletteOpenFile: string; paletteOpenSidePanel: string; palettePanelAttention: (count: number, waiting: boolean) => string; palettePanelsGroup: string; palettePanelTitle: (label: string) => string; paletteReducedMotion: string; paletteSearchPlaceholder: string; paletteSessionActionsGroup: string; paletteSessionCurrent: string; paletteSessionsGroup: string; paletteSessionStatus: Record<'error' | 'attention' | 'running' | 'pending', string>; paletteSettingsGroup: string; paletteShowLegacyModels: string; paletteShowLegacyModelsHint: string; paletteSidebarRunDetails: string; paletteSidebarRunDetailsHint: string; paletteSwitchToSession: string; paletteUnavailable: string; paletteUntitledSession: string; paletteViewGroup: string; paletteWordWrap: string }>

Overrides for the palette area's strings. Keys you leave out keep the default English label.

ui/src/palette/PaletteProvider.tsx:52

PaletteRowsInterface#

The renderers createPaletteRows returns, for CommandPalette.

TypeScript
interface PaletteRows
PaletteRows properties
NameTypeDescription
renderIcon(row: PaletteRowData<PaletteItem>) => ReactNode

A file's type badge, else the item's own glyph.

renderKeysPaletteKeys

Keycaps for binding specs that may list alternatives (ctrl+w | cmd+w).

renderRow(props: PaletteRowProps<PaletteItem>) => ReactNode

A session or a conversation match; any other row is the surface's (undefined).

ui/src/palette/PaletteRows.tsx:57

PaletteRowsOptionsInterface#

What the rows read from the app. Every member is optional.

TypeScript
interface PaletteRowsOptions
PaletteRowsOptions properties
NameTypeDescription
highlight?(excerpt: string, query: string) => { ranges: readonly PaletteTextRange[]; text: string }

Cuts a conversation excerpt around its first match and marks the query's terms in it. Absent: plain excerpt.

StatusDot?ComponentType<{ sessionId: string }>

A session's live status dot, in the row's icon slot.

useSession?(sessionId: string) => { current: boolean; updatedAt: number } | undefined

A loaded session's last update and whether it is the one on show (a hook, called once per session row).

useSessionStatus?(sessionId: string) => string | undefined

A session's live status (a hook, called once per session row).

ui/src/palette/PaletteRows.tsx:45

PaletteSourceInterface#

Source of palette items and the handler that runs them.

TypeScript
interface PaletteSource
PaletteSource properties
NameTypeDescription
idstring

Provider id, stamped on its items as source.

items(ctx: PaletteContext) => readonly PaletteItem[] | Promise<readonly PaletteItem[]>

Items for the current context. Called on open, on subscribe emits, and on explicit refresh.

run(itemId: string, ctx: PaletteContext) => PaletteRunResult | Promise<PaletteRunResult>

Runs the item with the given id. May return a follow-up result.

subscribe?(emit: () => void) => () => void

Live updates while the palette is open, same contract as panels.

dist/index-Bq87OcGy.d.ts:28165

RankedItemsInterface#

What useRankedItems returns.

TypeScript
interface RankedItems
RankedItems properties
NameTypeDescription
rowsreadonly RankedPaletteItem[]

The rows to show.

settledboolean

The rows are for this query (Enter waits for that).

ui/src/palette/useRankedItems.ts:53

Types#

CommandPalettePropsType#

Props for CommandPalette.

TypeScript
type CommandPaletteProps = Pick<PalettePanelProps<PaletteItem>, 'verb' | 'renderRow' | 'renderIcon' | 'renderKeys' | 'className' | 'style'> & { busy?: boolean; controller: PaletteController; extraGroups?: readonly PaletteSection<PaletteItem>[] }

ui/src/palette/CommandPalette.tsx:15

PaletteRunResultType#

What a provider's run may hand back. items opens a nested picker (branches, environments); the host keeps a stack so Backspace on an empty query goes back one level. prompt sends text to the chat, insert puts it in the composer (a / command that takes arguments).

TypeScript
type PaletteRunResult =
  | void
  | undefined
  | { items: readonly PaletteItem[]; kind: 'items'; placeholder?: string; title?: string }
  | { kind: 'prompt'; text: string }
  | { kind: 'insert'; text: string }
  | { kind: 'notify'; text: string; tone?: 'info' | 'warn' | 'error' }

dist/index-Bq87OcGy.d.ts:28148

PaletteSessionStatusType#

A session's status as its palette row words it; quiet states say nothing.

TypeScript
type PaletteSessionStatus = 'running' | 'pending' | 'attention' | 'error'

ui/src/palette/PaletteRows.tsx:42

PaletteTextRangeType#

A half-open [start, end) range of a text.

TypeScript
type PaletteTextRange = readonly [start: number, end: number]

ui/src/palette/PaletteRows.tsx:39