Plugin Menu

The composer's + menu of connectors and plugin commands, and the commands as cards on an empty screen.

Pick a command

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/plugin-menu

Usage

import { PluginMenu } from "./ui/uicontext/components/kit/PluginMenu.ts"
const Message = UiSchema.TaggedEnum({	PickedCommand: { plugin: Schema.String, command: Schema.String },	ToggledConnector: { id: Schema.String, included: Schema.Boolean },	ClickedManagePlugins: {},})// in the Composer's `tools` slot: connectors to include, and each plugin's commandsexport const AddToTask = (h: Html.H<typeof Message.Type>, mailIncluded: boolean) =>	PluginMenu(h, {		plugins: [{ id: "finance", name: "Finance", commands: [{ name: "reconcile", description: "Match last month's invoices to payments" }] }],		connectors: [{ id: "mail", name: "Mail", included: mailIncluded }],		onCommand: (plugin, command) => Message.PickedCommand({ plugin, command }),		onConnector: (id, included) => Message.ToggledConnector({ id, included }),		onManage: Message.ClickedManagePlugins(),	})

API reference

PluginMenuView function

Options

PluginMenu options
NameTypeDescription
keystringNames the menu among others in the same view
pluginsrequiredPlugin[]—
connectorsrequiredMenuConnector[]—
onCommandrequired(plugin: string, command: string) => MessageA command was picked, by plugin and name
onConnectorrequired(id: string, included: boolean) => Message—
onManageMessage—
onFilesMessage—
disabledboolean—

CommandCardsView function

Options

CommandCards options
NameTypeDescription
commandsrequiredReadonlyArray<PluginCommand & { readonly plugin: string; readonly pluginName?: string }>—
onPickrequired(plugin: string, command: string) => Message—
labelstring—
styleStyle—

Source