DocumentationApple Spotlight

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.

Install using CLI

npx shadcn@latest add "https://obsidianui.dev/r/apple-spotlight.json"

Install Manually

1

Install dependencies

npm install framer-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/ui/apple-spotlight.tsx

Usage

1import { AppleSpotlight } from "@/components/ui/apple-spotlight"
2import { useState } from "react"
3
4export function Demo() {
5const [isOpen, setIsOpen] = useState(false)
6
7return (
8 <>
9 <button onClick={() => setIsOpen(true)}>Open Spotlight</button>
10 <AppleSpotlight isOpen={isOpen} handleClose={() => setIsOpen(false)} />
11 </>
12)
13}

Props

Prop NameTypeDefaultDescription
isOpenbooleantrueControls visibility of spotlight
handleClose() => void-Callback when spotlight is closed
shortcutsShortcut[]default shortcutsArray of shortcut buttons