forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Autocomplete.spec.tsx
43 lines (38 loc) · 1.02 KB
/
Autocomplete.spec.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as React from 'react';
import Autocomplete from '@mui/joy/Autocomplete';
const top100Films = [{ title: 'The Shawshank Redemption', year: 1994 }];
<Autocomplete options={[]} componentsProps={{ listbox: { disablePortal: true } }} />;
<Autocomplete multiple placeholder="Favorites" options={[]} defaultValue={['a', 'b']} />;
<Autocomplete
placeholder="Favorites"
limitTags={2}
options={top100Films}
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13], top100Films[12], top100Films[11]]}
multiple
sx={{ width: '500px' }}
/>;
<Autocomplete
options={top100Films}
componentsProps={{
clearIndicator: {
color: 'danger',
variant: 'outlined',
size: 'sm',
},
popupIndicator: (ownerState) => ({
color: ownerState.inputFocused ? 'danger' : 'neutral',
variant: 'outlined',
size: 'sm',
}),
listbox: {
color: 'danger',
variant: 'outlined',
size: 'sm',
},
option: {
color: 'danger',
variant: 'outlined',
},
}}
/>;