Layout
AppCommandPalette
The Ctrl/⌘ K palette that searches every page the user can open and a few global actions.
Pages come from useNavigation(); add global actions to its actions list. The Keyboard shortcuts guide shows how.
Create actions
With an empty query the palette also offers a Create group: "Compose email", "New event", "New product"… Each one opens its page with ?new, and the page opens its create form. An action shows only when its route exists and, when it is gated, when the user has the permission.
Add one in two steps. First, an entry in createCandidates in components/layout/AppCommandPalette.vue, with its title under commandPalette.create in locales/<code>/common.json:
...(can('reports.create')
? [
{
key: 'create:report',
group: 'create',
title: t('commandPalette.create.report'),
icon: 'file-plus',
to: `/reports?${CREATE_INTENT_QUERY}`,
},
]
: []),
Then let the page open its form when it arrives with ?new, through useCreateIntent():
const formPanel = ref<InstanceType<typeof ReportFormPanel>>()
useCreateIntent(() => formPanel.value?.create())
createCandidates list is empty and the palette shows no Create group until you add your first module.API
This component has no props, slots or events of its own.