Cloud|

@k2b/ui

Spotlight search

Portable search launchers and keyboard shortcut behavior.

SpotlightButton@k2b/ui

Search launchers keep one shortcut contract while adapting to buttons, chips, sidebars, mobile navigation, and icon-only toolbars.

Page actions
Sidebar
Mobile navigation
Toolbar

TSX

Copy
import {
openSpotlightSearch,
SpotlightButton,
type SpotlightSearchResolver,
} from "@k2b/ui";
const spotlightProjects = [
{ label: "Atlas", desc: "Customer portal", value: "atlas" },
{ label: "Beacon", desc: "Operations dashboard", value: "beacon" },
{ label: "Cedar", desc: "Documentation site", value: "cedar" },
];
const resolveSpotlightProjects: SpotlightSearchResolver<string> = ({ query }) => {
const normalizedQuery = query.trim().toLowerCase();
return spotlightProjects.filter((project) =>
`${project.label} ${project.desc}`.toLowerCase().includes(normalizedQuery),
);
};
const openSearch = async () => {
await openSpotlightSearch<string>({
title: "Open project",
placeholder: "Search projects...",
noResultsText: "No matching projects.",
resolve: resolveSpotlightProjects,
});
};
<SpotlightButton variant="default" onClick={openSearch} />
<SpotlightButton variant="chip" onClick={openSearch} />
<SpotlightButton variant="sidebar" onClick={openSearch} />
<SpotlightButton variant="sidebar-mobile" onClick={openSearch} />
<SpotlightButton variant="compact" onClick={openSearch} />
<SpotlightButton variant="icon" onClick={openSearch} />

SpotlightButton launches the portable search prompt with one shortcut and accessible-name contract across navigation contexts.

Use it for a global or scoped entity search that should open from several navigation surfaces.

Import

tsx
import { openSpotlightSearch, SpotlightButton } from "@k2b/ui";

Example

tsx
const openSearch = () => openSpotlightSearch({
  title: "Open project",
  resolve: ({ query }) => projects.filter((project) => project.label.includes(query)),
});

<SpotlightButton variant="chip" onClick={openSearch} />

Variants cover default, compact, chip, sidebar, sidebar-mobile, and icon launchers.

Accessibility

Every variant retains an accessible label. isSpotlightShortcut recognizes Command+Shift+K and Control+Shift+K.

Runtime

The button renders during SSR; opening and resolving the prompt require hydration.

Connect a coding agent

The Cloud skill provides compact working instructions. MCP supplies exact current documentation when details matter.

CLI command
bunx skills add https://docs.example.com

This command installs the working instructions published by this website in the selected coding agent.

For exact, current details, also connect the MCP server through one of the agent tabs.

Installation uses the open-source Vercel Skills CLI.

The skill and MCP complement each other: the skill describes workflows, while MCP supplies current documentation.