Skip to content

Glass Menu

A Command-K style interface with deep glassmorphism and backdrop filtering.

Usage

tsx
import { GlassMenu } from '@peacock-ui/core'
import { useState } from 'react'

function Example() {
  const [isOpen, setIsOpen] = useState(false)

  const items = [
    { id: '1', label: 'Documentation', icon: <Book size={16} /> },
    { id: '2', label: 'Components', icon: <Box size={16} /> },
    { id: '3', label: 'GitHub', icon: <Github size={16} /> },
  ]

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Open Menu</button>
      <GlassMenu 
        isOpen={isOpen} 
        onClose={() => setIsOpen(false)} 
        items={items} 
      />
    </>
  )
}

Props

PropTypeDefaultDescription
isOpenbooleanfalseControls the visibility of the menu.
onClose() => void-Callback triggered when the menu should close (e.g., clicking backdrop).
itemsGlassMenuItem[][]Array of items to display in the menu.

GlassMenuItem

PropTypeDescription
idstringUnique identifier for the item.
labelstringThe text to display.
iconReactNodeOptional icon to display on the left.
onClick() => voidCallback triggered when the item is clicked.

Released under the MIT License.