material-ui
material-ui copied to clipboard
unable to add multiple icons into ListItem
How can I add multiple icons into listitem? for example:
var item = <ListItem key={k.id}
primaryText={k.number}
leftCheckbox={<Checkbox name="checkbox"></Checkbox>}
rightIcon={[<FontIcon className="material-icons" >home</FontIcon>,
<FontIcon className="material-icons" >battery-full</FontIcon>]}
/>
Tried it without making a list separated by commas?
yes, it does not work. The error is "JSX must be wrapped into adjacent DOM element", tried wrapping it.
rightIcon={<div><FontIcon className="material-icons" >home</FontIcon>,
<FontIcon className="material-icons" >battery-full</FontIcon></div>}
still does not work((
@Maksadbek The rightIcon prop isn't set up to handle this right now. However, you could pass this into its children and manually position it accordingly. For example:
var item =(
<ListItem
key={k.id}
primaryText={k.number}
leftCheckbox={<Checkbox name="checkbox"></Checkbox>}>
<FontIcon className="material-icons">home</FontIcon>
<FontIcon className="material-icons">battery-full</FontIcon>
</ListItem>
);
Thanks, it works