Skip to content

List View

Display a list of items.

interface CommandJSONViewList {
type: 'list';
shouldFilter?: boolean;
items: CommandJSONViewListItem[];
}
PropertyTypeDescription
typelistThe view type
itemsCommandJSONViewListItem[]The list items
shouldFilter?booleanWhether to filter the items when the Command Bar search panel value is changed

Example

console.log(JSON.stringify({
view: {
type: 'list',
items: [
{
value: 'open-url',
icon: 'icon:Link',
title: 'Open an URL',
actions: [
{ type: 'open-url', url: 'https://google.com', defaultAction: true }
],
},
{
value: 'paste-emoji',
icon: 'icon:Clipboard',
title: 'Paste Emoji',
actions: [
{ type: 'paste', content: '🀯', defaultAction: true }
],
},
],
}
}))

List Item

Item for the list type view.

interface CommandJSONViewListItem {
title: string;
value: string;
icon?: string;
group?: string;
subtitle?: string;
description?: string;
actions?: CommandJSONViewListItemAction[];
}
PropertyTypeDescription
valuestringThe list item’s unique value
titlestringThe list item’s title that will be displayed
icon?stringThe list item’s icon. This can be an image URL or use the icon:ICON_NAME format to use the built-in icon. Replace the ICON_NAME with the icon’s name you can find here.
actions?CommandJSONViewListItemAction[]The list item’s actions
subtitle?stringSubtitle that will be displayed next to the title
description?stringShortcut description about the item

List Item Action

Action of the list item. it’s similar with the Action except it has additional properties.

interface CommandJSONViewListItemAction extends CommandJSONAction {
defaultAction?: boolean;
}
PropertyTypeDescription
defaultAction?booleanWhether to perform the current action when the user selects the item
...restCommandJSONAction