'use client' import { Fragment, useState } from 'react' import { Listbox, Transition } from '@headlessui/react' import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/20/solid' const people = [ { name: 'Wade Cooper' }, { name: 'Arlene Mccoy' }, { name: 'Devon Webb' }, { name: 'Tom Cook' }, { name: 'Tanya Fox' }, { name: 'Hellen Schmidt' }, ] export default function Example() { const [selected, setSelected] = useState(people[0]) return (
{selected.name} {people.map((person, personIdx) => ( `relative cursor-default select-none py-2 pl-10 pr-4 ${ active ? 'bg-amber-100 text-amber-900' : 'text-gray-900' }` } value={person} > {({ selected }) => ( <> {person.name} {selected ? ( ) : null} )} ))}
) }