For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
/
144
Sponsor

Command Menu

A command palette with search and filtered rows.

Type a command or search…
Profile⌘ P
Settings⌘ S
New File⌘ N
Search docs

Installation

$ pnpm dlx shadcn@latest add @framecn/command-menu

Usage

import { CommandMenu } from "@/components/ui/command-menu";
<div style={{ position: "relative", width: "100%", height: "100%" }}>
  <CommandMenu state="opened" query="set" />
</div>

Wrap in a positioned container — the panel and backdrop fill the composition.

Smooth transitions

The docs preview opens the palette, types "settings" to filter the list, animates a row hover → press → selected, then closes. Drive the panel with useCommandMenuTransition, typing with revealCount from @/lib/framecn-ui, and row states with useCommandMenuItemTransition:

import { useCurrentFrame, revealCount } from "@/lib/framecn-ui";
import { CommandMenu } from "@/components/framecn/command-menu";
import { useCommandMenuTransition } from "@/components/framecn/use-command-menu-transition";
import { useCommandMenuItemTransition } from "@/components/framecn/use-command-menu-item-transition";
 
const QUERY = "settings";
const TYPE_START = 20;
 
export const Scene = () => {
  const frame = useCurrentFrame();
 
  const panelStyle = useCommandMenuTransition([
    { at: 16, state: "opened", duration: 16 },
    { at: 108, state: "closed", duration: 12 },
  ]);
 
  const revealed = revealCount(
    Math.max(0, frame - TYPE_START),
    30,
    QUERY.length,
    4
  );
 
  const itemStyle = useCommandMenuItemTransition([
    { at: 84, state: "hover", duration: 8 },
    { at: 92, state: "press", duration: 6 },
    { at: 100, state: "selected", duration: 8 },
  ]);
 
  return (
    <div style={{ position: "relative", width: "100%", height: "100%" }}>
      <CommandMenu
        style={panelStyle}
        query={QUERY}
        revealCount={revealed}
        itemStyles={[itemStyle]}
      />
    </div>
  );
};

style takes precedence over state when both are provided. itemStyles is indexed into the filtered list.

API Reference

CommandMenu

PropTypeDefault
state"opened" | "closed""closed"
styleCommandMenuStyle- (takes precedence over state)
querystring""
revealCountnumber- (full query shown when omitted)
itemsCommandMenuEntry[]Profile, Settings, New File, Search docs
selectedIndexnumber-1
highlightedIndexnumber-1
pressedIndexnumber-1
itemStyles(CommandMenuItemStyle | undefined)[]- (indexed into filtered list)
themePartial<FramecnTheme>-
classNamestring-