Apple Spotlight
A macOS-style spotlight search component with animated shortcuts and search results. Features a beautiful blur effect, animated shortcut buttons, and live search results.
Component preview
Install using CLI
npx shadcn@latest add "https://www.obsidianui.dev/r/apple-spotlight.json"Install Manually
1
Install dependencies
npm install motion lucide-react clsx tailwind-merge
2
Add util file
Create a file lib/utils.ts:
import { ClassValue, clsx } from 'clsx';import { twMerge } from 'tailwind-merge';export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
3
Copy the source code
Copy the code into components/block/apple-spotlight.tsx
Usage
Code
import { AppleSpotlight } from "@/components/block/apple-spotlight"import { useState } from "react"export function Demo() {const [isOpen, setIsOpen] = useState(false)return (<><button onClick={() => setIsOpen(true)}>Open Spotlight</button><AppleSpotlight isOpen={isOpen} handleClose={() => setIsOpen(false)} /></>)}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| isOpen | boolean | true | Controls visibility of spotlight |
| handleClose | () => void | - | Callback when spotlight is closed |
| shortcuts | Shortcut[] | default shortcuts | Array of shortcut buttons |
Last updated on