Getting Started
import { Autocomplete } from '@bedrock-ui/core';
<Autocomplete>
<Autocomplete.Option>Lorem ipsum</Autocomplete.Option>
<Autocomplete.Option>dolor sit amet</Autocomplete.Option>
<Autocomplete.Option>consectetur adipiscing elit</Autocomplete.Option>
</Autocomplete>
const STATE_OPTIONS = {
CO: ['Boulder', 'Denver'],
NJ: ['Atlantic City', 'Jersey City', 'Trenton'],
VA: ['Arlington', 'Richmond', 'Virginia Beach'],
};
<Autocomplete>
{Object.keys(STATE_OPTIONS).map((state, index) => (
<Flex flexDirection="column" key={index}>
<Flex p={2}>
<Text>{state}</Text>
</Flex>
{STATE_OPTIONS[state as keyof typeof STATE_OPTIONS].map((option, optionIndex) => (
<Autocomplete.Option key={`${index}-${optionIndex}`}>
<Flex px={2}>{option}</Flex>
</Autocomplete.Option>
))}
</Flex>
))}
</Autocomplete>
<Autocomplete error>
<Autocomplete.Option>Lorem ipsum</Autocomplete.Option>
<Autocomplete.Option>dolor sit amet</Autocomplete.Option>
<Autocomplete.Option>consectetur adipiscing elit</Autocomplete.Option>
</Autocomplete>
<Autocomplete success>
<Autocomplete.Option>Lorem ipsum</Autocomplete.Option>
<Autocomplete.Option>dolor sit amet</Autocomplete.Option>
<Autocomplete.Option>consectetur adipiscing elit</Autocomplete.Option>
</Autocomplete>