Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@headless-react/combobox

so99ynoodles109Apache-2.00.0.16TypeScript support: included

Headless React components using react-stately and react-aria

react, react-aria, react-stately

readme

@headless-react/combobox

Headless React ComboBox component with @react-aria and @react-stately.

Getting Started

$ npm install @headless-react/combobox
import { ComboBox } from '@headless-react/combobox'

const AutoComplete = ({
  label,
  items
}) => {
  return (
    <ComboBox defaultItems={items}>
      <ComboBox.Label>{label}</ComboBox.Label>
      <ComboBox.InputGroup>
        {({ selectedItem }) => (
          <>
            <ComboBox.Input />
            <ComboBox.PopoverTrigger />
          </>
        )}
      </ComboBox.InputGroup>
      <ComboBox.Popover>
        <ComboBox.Options>
          {({ options }) => options.map(option => (
            <ComboBox.Option key={option.key} option={option}>
              {option.name}
            </ComboBox.Option>
          ))}
        </ComboBox.Options>
      </ComboBox.Popover>
    </ComboBox>
  )
}

Example

CodeSandBox Example