File tree Expand file tree Collapse file tree
docs/data/material/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import Checkbox from '@mui/material/Checkbox' ;
21import TextField from '@mui/material/TextField' ;
32import Autocomplete from '@mui/material/Autocomplete' ;
43import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank' ;
54import CheckBoxIcon from '@mui/icons-material/CheckBox' ;
65
7- const icon = < CheckBoxOutlineBlankIcon fontSize = "small" /> ;
8- const checkedIcon = < CheckBoxIcon fontSize = "small" /> ;
9-
106export default function CheckboxesTags ( ) {
117 return (
128 < Autocomplete
@@ -17,13 +13,13 @@ export default function CheckboxesTags() {
1713 getOptionLabel = { ( option ) => option . title }
1814 renderOption = { ( props , option , { selected } ) => {
1915 const { key, ...optionProps } = props ;
16+ const SelectionIcon = selected ? CheckBoxIcon : CheckBoxOutlineBlankIcon ;
17+
2018 return (
2119 < li key = { key } { ...optionProps } >
22- < Checkbox
23- icon = { icon }
24- checkedIcon = { checkedIcon }
25- style = { { marginRight : 8 } }
26- checked = { selected }
20+ < SelectionIcon
21+ fontSize = "small"
22+ style = { { marginRight : 8 , padding : 9 , boxSizing : 'content-box' } }
2723 />
2824 { option . title }
2925 </ li >
Original file line number Diff line number Diff line change 1- import Checkbox from '@mui/material/Checkbox' ;
21import TextField from '@mui/material/TextField' ;
32import Autocomplete from '@mui/material/Autocomplete' ;
43import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank' ;
54import CheckBoxIcon from '@mui/icons-material/CheckBox' ;
65
7- const icon = < CheckBoxOutlineBlankIcon fontSize = "small" /> ;
8- const checkedIcon = < CheckBoxIcon fontSize = "small" /> ;
9-
106export default function CheckboxesTags ( ) {
117 return (
128 < Autocomplete
@@ -17,13 +13,13 @@ export default function CheckboxesTags() {
1713 getOptionLabel = { ( option ) => option . title }
1814 renderOption = { ( props , option , { selected } ) => {
1915 const { key, ...optionProps } = props ;
16+ const SelectionIcon = selected ? CheckBoxIcon : CheckBoxOutlineBlankIcon ;
17+
2018 return (
2119 < li key = { key } { ...optionProps } >
22- < Checkbox
23- icon = { icon }
24- checkedIcon = { checkedIcon }
25- style = { { marginRight : 8 } }
26- checked = { selected }
20+ < SelectionIcon
21+ fontSize = "small"
22+ style = { { marginRight : 8 , padding : 9 , boxSizing : 'content-box' } }
2723 />
2824 { option . title }
2925 </ li >
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import MenuItem from '@mui/material/MenuItem';
55import FormControl from '@mui/material/FormControl' ;
66import ListItemText from '@mui/material/ListItemText' ;
77import Select from '@mui/material/Select' ;
8- import Checkbox from '@mui/material/Checkbox' ;
8+ import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank' ;
9+ import CheckBoxIcon from '@mui/icons-material/CheckBox' ;
910
1011const ITEM_HEIGHT = 48 ;
1112const ITEM_PADDING_TOP = 8 ;
@@ -58,12 +59,20 @@ export default function MultipleSelectCheckmarks() {
5859 renderValue = { ( selected ) => selected . join ( ', ' ) }
5960 MenuProps = { MenuProps }
6061 >
61- { names . map ( ( name ) => (
62- < MenuItem key = { name } value = { name } >
63- < Checkbox checked = { personName . includes ( name ) } />
64- < ListItemText primary = { name } />
65- </ MenuItem >
66- ) ) }
62+ { names . map ( ( name ) => {
63+ const selected = personName . includes ( name ) ;
64+ const SelectionIcon = selected ? CheckBoxIcon : CheckBoxOutlineBlankIcon ;
65+
66+ return (
67+ < MenuItem key = { name } value = { name } >
68+ < SelectionIcon
69+ fontSize = "small"
70+ style = { { marginRight : 8 , padding : 9 , boxSizing : 'content-box' } }
71+ />
72+ < ListItemText primary = { name } />
73+ </ MenuItem >
74+ ) ;
75+ } ) }
6776 </ Select >
6877 </ FormControl >
6978 </ div >
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import MenuItem from '@mui/material/MenuItem';
55import FormControl from '@mui/material/FormControl' ;
66import ListItemText from '@mui/material/ListItemText' ;
77import Select , { SelectChangeEvent } from '@mui/material/Select' ;
8- import Checkbox from '@mui/material/Checkbox' ;
8+ import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank' ;
9+ import CheckBoxIcon from '@mui/icons-material/CheckBox' ;
910
1011const ITEM_HEIGHT = 48 ;
1112const ITEM_PADDING_TOP = 8 ;
@@ -58,12 +59,20 @@ export default function MultipleSelectCheckmarks() {
5859 renderValue = { ( selected ) => selected . join ( ', ' ) }
5960 MenuProps = { MenuProps }
6061 >
61- { names . map ( ( name ) => (
62- < MenuItem key = { name } value = { name } >
63- < Checkbox checked = { personName . includes ( name ) } />
64- < ListItemText primary = { name } />
65- </ MenuItem >
66- ) ) }
62+ { names . map ( ( name ) => {
63+ const selected = personName . includes ( name ) ;
64+ const SelectionIcon = selected ? CheckBoxIcon : CheckBoxOutlineBlankIcon ;
65+
66+ return (
67+ < MenuItem key = { name } value = { name } >
68+ < SelectionIcon
69+ fontSize = "small"
70+ style = { { marginRight : 8 , padding : 9 , boxSizing : 'content-box' } }
71+ />
72+ < ListItemText primary = { name } />
73+ </ MenuItem >
74+ ) ;
75+ } ) }
6776 </ Select >
6877 </ FormControl >
6978 </ div >
You can’t perform that action at this time.
0 commit comments