BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/spectrumui/command-palette-demo

Command Palette Demo

spectrumui/command-palette-demo
FreeComponent

Demo usage for the Command Palette component

Install it

npx shadcn@latest add https://ui.spectrumhq.in/r/command-palette-demo.json

Source

app/registry/command-palette/command-palette-demo.tsxui.spectrumhq.in/r/command-palette-demo.json
1"use client"
2
3import React, { useState, useEffect, useCallback } from "react"
4import { CommandPalette } from "./command-palette"
5import { Button } from "@/components/ui/button"
6
7export default function CommandPaletteDemo() {
8 const [isOpen, setIsOpen] = useState(false)
9
10 const handleClose = useCallback(() => {
11 setIsOpen(false)
12 }, [])
13
14 // Listen for global command/control key trigger
15 useEffect(() => {
16 const handleKeyDown = (e: KeyboardEvent) => {
17 if ((e.metaKey || e.ctrlKey) && e.key === "k") {
18 e.preventDefault()
19 setIsOpen((open) => !open)
20 }
21 }
22 window.addEventListener("keydown", handleKeyDown)
23 return () => window.removeEventListener("keydown", handleKeyDown)
24 }, [])
25
26 return (
27 <div className="flex flex-col items-center justify-center gap-4 py-8 text-center select-none">
28 <p className="text-sm text-neutral-500 dark:text-neutral-400">
29 Press <kbd className="bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 px-1.5 py-0.5 rounded text-xs font-mono font-medium text-neutral-800 dark:text-neutral-200">⌘K</kbd> or <kbd className="bg-neutral-100 dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 px-1.5 py-0.5 rounded text-xs font-mono font-medium text-neutral-800 dark:text-neutral-200">Ctrl+K</kbd> to open the palette
30 </p>
31
32 <Button
33 variant="outline"
34 onClick={() => setIsOpen(true)}
35 className="rounded-xl px-5 py-2 hover:bg-neutral-50 dark:hover:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 font-medium text-sm transition-colors cursor-pointer"
36 >
37 Open Command Palette
38 </Button>
39
40 <CommandPalette isOpen={isOpen} onClose={handleClose} />
41 </div>
42 )
43}

What it pulls in

Other registry items

  • @spectrumui/command-palette
  • button

Files it writes

  • app/registry/command-palette/command-palette-demo.tsx

Facts

Registry
spectrumui
Type
registry:component
Access
Free
Files written
1
Licence
Apache-2.0
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

ui.spectrumhq.in arihantcodes/spectrum-ui on GitHub Raw registry item This item as JSON

More from spectrumui

All 182 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionspectrumuiComponentsFreeno deps
Alert demoalert-1spectrumuiComponentsFree1 dep
Alert 2alert-2spectrumuiComponentsFreeno deps
Alert 3alert-3spectrumuiComponentsFree1 dep
Alert 4alert-4spectrumuiComponentsFree1 dep
Animated Cardanimated-cardspectrumuiComponentsFree1 dep · 2 files
Animated Draweranimated-drawerspectrumuiComponentsFree4 deps
Animated SVG Chartanimated-SVG-chartspectrumuiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex