# Command Menu

> The ⌘K palette: ranked commands with shortcuts, keyboard navigation and matched letters bolded.

- Tier: free, MIT
- Category: Navigation
- Docs: https://ui.mlola.com/docs/components/command-menu

## Install

```bash
npx mlola-ui add command-menu
```

```tsx
import { CommandMenu } from "@/components/ui/command-menu";
```

## Example

```tsx
"use client";

import * as React from "react";
import { Button } from "@/components/ui/button";
import { CommandMenu } from "@/components/ui/command-menu";

export default function Example() {
  const [open, setOpen] = React.useState(false);
  return (
    <>
      <Button variant="secondary" onClick={() => setOpen(true)}>Search commands</Button>
      <CommandMenu
        open={open}
        onOpenChange={setOpen}
        groups={[
          {
            heading: "Project",
            items: [
              { id: "new", label: "New project", shortcut: "mod+n", onSelect: () => setOpen(false) },
              { id: "invite", label: "Invite a teammate", onSelect: () => setOpen(false) },
            ],
          },
        ]}
      />
    </>
  );
}
```

## The same markup without React

```html
<button class="ml-button" type="button" data-variant="secondary" data-size="md"><span class="ml-button-label">Search commands</span></button>
```
