Twitter2.3k

Command

Fast, composable, command menu for Angular.

SuggestionsSettings

Installation

ng g @spartan-ng/cli:ui command

Usage

import { HlmCommandImports } from '@spartan-ng/helm/command';
<hlm-command>
  <hlm-command-input placeholder="Type a command or search..." />
  <hlm-command-list>
  	<div *hlmCommandEmptyState hlmCommandEmpty>No results found.</div>
    <hlm-command-group>
      <hlm-command-group-label>Suggestions</hlm-command-group-label>
      <button hlm-command-item value="Calendar">
        <ng-icon name="lucideCalendar" />
        Calendar
      </button>
    </hlm-command-group>
    <hlm-command-separator />
    <hlm-command-group>
      <hlm-command-group-label>Settings</hlm-command-group-label>
      <button hlm-command-item value="Profile">
        <ng-icon name="lucideUser" />
        Profile
        <hlm-command-shortcut>P</hlm-command-shortcut>
      </button>
    </hlm-command-group>
  </hlm-command-list>
</hlm-command>

Examples

Dialog

Press ⌘ + J

Last command: none

Combobox

You can use the Command component as a combobox. Otherwise use the Combobox component for more advanced use cases.

Brain API

BrnCommandEmpty

Selector: [brnCommandEmpty]

BrnCommandGroup

Selector: [brnCommandGroup]

Inputs

PropTypeDefaultDescription
id string `brn-command-group-${++BrnCommandGroup._id}` The id of the command list

BrnCommandInput

Selector: input[brnCommandInput]

Inputs

PropTypeDefaultDescription
id string this._initialId The id of the command input

BrnCommandItem

Selector: button[brnCommandItem]

Inputs

PropTypeDefaultDescription
id string `brn-command-item-${++BrnCommandItem._id}` A unique id for the item
value* (required) string - The value this item represents.
disabled boolean false Whether the item is disabled.

Outputs

PropTypeDefaultDescription
selected void - Emits when the item is selected.

BrnCommandList

Selector: [brnCommandList]

Inputs

PropTypeDefaultDescription
id string `brn-command-list-${++BrnCommandList._id}` The id of the command list

BrnCommandSeparator

Selector: [brnCommandSeparator]

BrnCommand

Selector: [brnCommand]

Inputs

PropTypeDefaultDescription
id string `brn-command-${++BrnCommand._id}` The id of the command
filter CommandFilter this._config.filter A custom filter function to use when searching.
disabled boolean false Whether the command is disabled
search string - The current search query.

Outputs

PropTypeDefaultDescription
valueChange string - when the selection has changed
searchChanged string - The current search query.

Helm API

HlmCommandDialog

Selector: hlm-command-dialog

Inputs

PropTypeDefaultDescription
title string Command Palette -
description string Search for a command to run... -
state BrnDialogState closed -
showCloseButton boolean false -
dialogContentClass ClassValue --

Outputs

PropTypeDefaultDescription
stateChange BrnDialogState --

HlmCommandEmptyState

Selector: [hlmCommandEmptyState]

HlmCommandEmpty

Selector: [hlmCommandEmpty]

HlmCommandGroupLabel

Selector: [hlmCommandGroupLabel],hlm-command-group-label

HlmCommandGroup

Selector: [hlmCommandGroup],hlm-command-group

HlmCommandInput

Selector: hlm-command-input

Inputs

PropTypeDefaultDescription
id string | undefined --
placeholder string --

HlmCommandItem

Selector: button[hlmCommandItem],button[hlm-command-item]

HlmCommandList

Selector: [hlmCommandList],hlm-command-list

HlmCommandSeparator

Selector: [hlmCommandSeparator],hlm-command-separator

HlmCommandShortcut

Selector: [hlmCommandShortcut],hlm-command-shortcut

HlmCommand

Selector: [hlmCommand],hlm-command

Context Menu Combobox