LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Components

Command palette

Also called command menu or Cmd+K menu

A search box that opens with a shortcut like ⌘K and lets you find and run any command or page by typing a few letters.

import { useEffect, useState } from 'react';
import { Autocomplete } from '@base-ui/react/autocomplete';
import { Dialog } from '@base-ui/react/dialog';

type Command = { label: string; shortcut?: string; run: () => void };
const POPUP =
  'fixed top-24 left-1/2 w-140 max-w-[calc(100vw-2rem)] -translate-x-1/2 overflow-hidden rounded-xl border bg-background shadow-2xl transition-[opacity,scale] duration-150 ease-out data-ending-style:scale-[0.98] data-ending-style:opacity-0 data-starting-style:scale-[0.98] data-starting-style:opacity-0';

export function CommandPalette({ commands }: { commands: Command[] }) {
  const [open, setOpen] = useState(false);

  useEffect(() => {
    function onKeyDown(event: KeyboardEvent) {
      if (event.key !== 'k' || !(event.metaKey || event.ctrlKey)) return;
      event.preventDefault();
      setOpen((value) => !value);
    }
    document.addEventListener('keydown', onKeyDown);
    return () => document.removeEventListener('keydown', onKeyDown);
  }, []);
  return (
    <Dialog.Root open={open} onOpenChange={setOpen}>
      <Dialog.Trigger className='flex gap-6 rounded-lg border px-3 py-1.5 text-sm text-muted-foreground'>
        Search <kbd>⌘K</kbd>
      </Dialog.Trigger>
      <Dialog.Portal>
        <Dialog.Backdrop className='fixed inset-0 bg-black/40 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0' />
        <Dialog.Popup aria-label='Command palette' className={POPUP}>
          {/* Inline and always open, since the dialog is the popup. */}
          <Autocomplete.Root open inline items={commands} autoHighlight>
            <Autocomplete.Input
              aria-label='Search commands'
              placeholder='Type a command or search…'
              className='h-12 w-full border-b bg-transparent px-4 text-sm outline-none'
            />
            <Autocomplete.Empty className='p-4 text-sm text-muted-foreground empty:p-0'>
              No results.
            </Autocomplete.Empty>
            <Autocomplete.List className='max-h-80 overflow-y-auto p-2 data-empty:p-0'>
              {(command: Command) => (
                <Autocomplete.Item
                  key={command.label}
                  value={command}
                  onClick={() => {
                    command.run();
                    setOpen(false);
                  }}
                  className='flex cursor-default justify-between rounded-lg px-3 py-2 text-sm outline-none select-none data-highlighted:bg-muted'
                >
                  {command.label}
                  <kbd className='text-xs opacity-60'>{command.shortcut}</kbd>
                </Autocomplete.Item>
              )}
            </Autocomplete.List>
          </Autocomplete.Root>
        </Dialog.Popup>
      </Dialog.Portal>
    </Dialog.Root>
  );
}
Add a ⌘K / Ctrl+K command palette: a 560px-wide panel near the top of the screen over a dimmed backdrop, with a search field and commands grouped under Navigation, Projects, and Settings that filter as you type with fuzzy matching. Support Up, Down, Enter, and Escape, show each command's shortcut on the right, open it with a 150ms fade and scale from 0.98, and add a 'Search ⌘K' button to the header for mouse users.

Paste into Layerwise or any AI coding tool.

What is Command palette?

A command palette is a keyboard-first launcher. Press ⌘K (Ctrl+K on Windows), a search field opens over the app, and the list of commands narrows as you type. Arrow keys move the highlight and Enter runs the command, so people can do almost anything without reaching for the mouse.

Add one when your app has more actions and pages than a toolbar can hold, as in editors, dashboards, and developer tools. It works alongside menus and buttons, which newer users still rely on, and showing each command's shortcut in the list helps people learn it.

Match loosely so 'new p' finds New project, rank recent commands first, and update the list on every keystroke. Pick a shortcut that does not clash with ones your app already uses, and add a visible Search button that shows the shortcut for people who don't know it.

Often confused with

Combobox
A combobox picks a value for one form field. A command palette searches and runs actions across the whole app.

Related terms

All terms

Keyboard shortcut

A key combination that runs an action directly, like ⌘S to save or ⌘K to open search, so frequent users can skip the mouse.

Combobox

A text field with a dropdown list that filters as you type, so people can pick one option from a long list quickly.

Modal

A window that opens over the page, dims everything behind it, and blocks the rest of the interface until you finish or dismiss it.

Dropdown menu

A list of actions that drops down from a button when you click it, then closes as soon as you pick one.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit
Projects
  • Website redesign
  • Mobile app