Command menu dialog — Search block
Prosearch-command-menu-dialog · for app pages
Command menu dialog
The app’s palette: a quiet trigger showing the shortcut, the panel opens over the page
Documentation
Installation
One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).
pnpm dlx shadcn-vue@latest add @trame/search-command-menu-dialogUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import SearchCommandMenuDialog from '@/components/trame/blocks/search/search-command-menu-dialog.vue'
const props = {
label: "Search…",
placeholder: "Find a repo, a pull request, a command…",
shortcut: "⌘K",
groups: [
{
label: "Pages",
items: [
{
id: "p1",
label: "Overview",
description: "Reviews and deploys today",
icon: "page",
shortcut: "⌘1",
action: "home"
},
{
id: "p2",
label: "Pull requests",
description: "34 awaiting review",
icon: "record",
action: "pulls"
}
]
},
{
label: "Actions",
items: [
{
id: "a1",
label: "Ask Prooflane to review a branch",
description: "Runs the AI review and the test suite",
icon: "create",
shortcut: "⌘N",
action: "review.create"
},
{
id: "a2",
label: "Invite a teammate",
icon: "user",
action: "team.invite"
}
]
}
],
recent: [
{
label: "flaky tests",
action: "pulls"
},
{
label: "payments-api",
action: "previews"
}
],
options: {
footnote: "Every repo, review and deploy in Prooflane, one shortcut away."
}
}
</script>
<template>
<SearchCommandMenuDialog v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe trigger’s words ("Search…") |
| placeholder | string | Wordsthe field’s placeholder ("Search for a page, a record, an action…") |
| shortcut | string | Wordsthe trigger’s keyboard shortcut as the app writes it ("⌘K") |
| groups | Group[] | Datathe entries, grouped (pages, records, actions) |
| recent | Recent[] | Datathe recent searches, the app’s own history |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Group groups[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe group’s heading ("Pages", "Actions") |
| items* | Item[] | the group’s items, in order |
Item groups[].items[] · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe entry’s id in the tool that answers it |
| label* | string | Wordswhat the entry says ("Orders", "Create a product") |
| description | string | Wordsa secondary line (a path, a count, a hint) |
| shortcut | string | Wordsthe entry’s keyboard shortcut as the app writes it ("⌘N") |
| icon | 'page' | 'record' | 'create' | 'user' | 'settings' | 'link' | the icon shown with the item |
| action* | string | Actionthe page the entry opens |
Recent recent[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsa recent search, as the visitor typed it |
| action* | string | Actionthe page it leads to |
Options options · 4 props
| Prop | Type | Description |
|---|---|---|
| emptyTitle | string | Wordswhat the panel says when nothing matches ("No results") |
| emptyText | string | Wordsthe empty state’s one line of advice |
| footnote | string | Wordsa line under the panel (the shortcut, the scope of the search) |
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a band of the page that redefines the theme surfaces inside it |
What it asks your app for
The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your word for an interface key, or undefined to keep the block’s own |
The words it says itself, in English and French; label(key) replaces any of them:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too many attempts, try again in a moment. | Trop de tentatives, réessayez dans un moment. |
Features
- Every word in the server HTML
- Same markup in Vue and React
- Theme tokens only: every theme, light and dark
- Shows what you give it, invents nothing
- No motion; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
groups[].items[],recent[]
A search section, for app pages; it uses @lucide/vue, @vueuse/core, class-variance-authority, clsx, reka-ui, tailwind-merge.
More search blocks
- Filter builder rows: Above a data table or in a filter panel: a stack of condition rows (field, operator, value) under "Match all / any", with "Add condition", "Apply" and "Save view" at the foot.
- Filter builder sentence: When the filter should read as plain words ("Show deals where stage is Won and amount is greater than 10000"): each part is a token that opens a small popover to change it.
- Inline commands open panel: the panel open in the page, for a search page or the app’s empty search state.
- Record faceted: A large index searched often: the kinds and their counts in a side column, the field and the flat list of hits beside it; on a phone the kinds fold into a row above.
- Record grouped: A first look across everything: one section per kind (projects, tasks, documents, people) with its best five hits and a "See all 24" link to that kind alone.
- Record tabbed: People who know what they want: tabs of the kinds with their counts above one flat list of mixed hits, each with its kind’s sign, its reference, the title with the matched words, a snippet and where it lives.