PureAdmin.Components.CommandPalette (PureAdmin v1.1.0)

Copy Markdown View Source

Command palette component with multi-step commands and scoped search.

Supports three modes:

  • Commands (/prefix) — multi-step action wizards with step progression
  • Search contexts (:prefix) — scoped entity search
  • Global search (no prefix) — search across everything

Display Styles

Two display styles for command step progression:

  • "inline" (default) — Svelte-style, the input shows the full accumulated text like a sentence: /assign iPad Air to |. A command badge shows on the right. The editable portion is after the last prompt.
  • "tokens" — The input is cleared on each step. Previous selections show as colored token spans above the input.

Usage

<%!-- Inline style (default, matches Svelte) --%>
<.command_palette id="cmd" is_open={@cp_open} mode={@cp_mode} ... />

<%!-- Token style --%>
<.command_palette id="cmd" display="tokens" is_open={@cp_open} mode={@cp_mode} ... />

Summary

Functions

command_palette(assigns)

Attributes

  • id (:string) - Defaults to "command-palette".
  • is_open (:boolean) - Defaults to false.
  • query (:string) - Defaults to "".
  • display (:string) - Step display style: inline (sentence in input) or tokens (spans above input). Defaults to "inline". Must be one of "inline", or "tokens".
  • mode (:string) - Defaults to "idle". Must be one of "idle", "command_list", "command_step", "context_list", "context_search", or "global_search".
  • commands (:list) - List of command maps. Defaults to [].
  • contexts (:list) - List of search context maps. Defaults to [].
  • results (:list) - Current items to display. Defaults to [].
  • active_index (:integer) - Defaults to -1.
  • is_loading (:boolean) - Defaults to false.
  • current_command (:map) - Active command in step mode. Defaults to nil.
  • current_step (:map) - Active step. Defaults to nil.
  • current_step_index (:integer) - Defaults to 0.
  • total_steps (:integer) - Defaults to 0.
  • selections (:list) - Previous step selections as [%{step_id, label}]. Defaults to [].
  • preview (:string) - Preview text for command. Defaults to nil.
  • input_text (:string) - Full input text for inline display mode. Defaults to "".
  • current_context (:map) - Active search context. Defaults to nil.
  • page (:integer) - Defaults to 1.
  • total_pages (:integer) - Defaults to 1.
  • total_results (:integer) - Defaults to 0.
  • placeholder (:string) - Defaults to nil.
  • empty_text (:string) - Defaults to nil.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.