UNPKG

react-garden

Version:

React + TypeScript + ThreeJS app using Material UI on NextJS, Apollo Client, GraphQL + WordPress REST APIs, for ThreeD web development.. a part of the threed.ai code family.

31 lines (25 loc) 854 B
// ** MUI Imports import TextField from '@mui/material/TextField' import Autocomplete from '@mui/material/Autocomplete' // ** Data import { top100Films } from '~/@fake-db/autocomplete' const AutocompleteGrouped = () => { const options = top100Films.map(option => { const firstLetter = option.title[0].toUpperCase() return { firstLetter: /[0-9]/.test(firstLetter) ? '0-9' : firstLetter, ...option } }) return ( <Autocomplete sx={{ width: 250 }} id='autocomplete-grouped' groupBy={option => option.firstLetter} getOptionLabel={option => option.title} renderInput={params => <TextField {...params} label='With categories' />} options={options.sort((a, b) => -b.firstLetter.localeCompare(a.firstLetter))} /> ) } export default AutocompleteGrouped