/* 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 { CalendarIcon, CodeBracketIcon, DocumentIcon, ExclamationCircleIcon, LinkIcon, PencilSquareIcon, PhotoIcon, TableCellsIcon, VideoCameraIcon, ViewColumnsIcon, Bars4Icon, } from '@heroicons/react/24/outline' const items = [ { id: 1, name: 'Text', description: 'Add freeform text with basic formatting options.', url: '#', color: 'bg-indigo-500', icon: PencilSquareIcon, }, // More items... ] function classNames(...classes) { return classes.filter(Boolean).join(' ') } export default function Example() { const [query, setQuery] = useState('') const [open, setOpen] = useState(true) const filteredItems = query === '' ? [] : items.filter((item) => { return item.name.toLowerCase().includes(query.toLowerCase()) }) return ( setQuery('')} appear>
(window.location = item.url)}>
{filteredItems.length > 0 && ( {filteredItems.map((item) => ( classNames('flex cursor-default select-none rounded-xl p-3', active && 'bg-gray-100') } > {({ active }) => ( <>

{item.name}

{item.description}

)}
))}
)} {query !== '' && filteredItems.length === 0 && (

No results found

No components found for this search term. Please try again.

)}
) }