/* This example requires some changes to your config: ``` // tailwind.config.js module.exports = { // ... plugins: [ // ... require('@tailwindcss/forms'), ], } ``` */ import { Fragment, useState } from 'react' import { Combobox, Dialog, Transition } from '@headlessui/react' import { MagnifyingGlassIcon } from '@heroicons/react/20/solid' import { DocumentPlusIcon, FolderPlusIcon, FolderIcon, HashtagIcon, TagIcon } from '@heroicons/react/24/outline' const projects = [ { id: 1, name: 'Workflow Inc. / Website Redesign', url: '#' }, // More projects... ] const recent = [projects[0]] const quickActions = [ { name: 'Add new file...', icon: DocumentPlusIcon, shortcut: 'N', url: '#' }, { name: 'Add new folder...', icon: FolderPlusIcon, shortcut: 'F', url: '#' }, { name: 'Add hashtag...', icon: HashtagIcon, shortcut: 'H', url: '#' }, { name: 'Add label...', icon: TagIcon, shortcut: 'L', url: '#' }, ] function classNames(...classes) { return classes.filter(Boolean).join(' ') } export default function Example() { const [query, setQuery] = useState('') const [open, setOpen] = useState(true) const filteredProjects = query === '' ? [] : projects.filter((project) => { return project.name.toLowerCase().includes(query.toLowerCase()) }) return ( setQuery('')} appear>
(window.location = item.url)}>
{(query === '' || filteredProjects.length > 0) && (
  • {query === '' && (

    Recent searches

    )}
      {(query === '' ? recent : filteredProjects).map((project) => ( classNames( 'flex cursor-default select-none items-center rounded-md px-3 py-2', active && 'bg-indigo-600 text-white' ) } > {({ active }) => ( <> ))}
  • {query === '' && (
  • Quick actions

      {quickActions.map((action) => ( classNames( 'flex cursor-default select-none items-center rounded-md px-3 py-2', active && 'bg-indigo-600 text-white' ) } > {({ active }) => ( <> ))}
  • )}
    )} {query !== '' && filteredProjects.length === 0 && (
    )}
    ) }