March 2019
Intermediate to advanced
534 pages
14h 52m
English
You can install the material-ui-chip-input package and use the ChipInput component, which brings together the Chip and TextInput components from Material-UI. The code is as follows:
import React, { useState } from 'react';import { makeStyles } from '@material-ui/styles';import ChipInput from 'material-ui-chip-input';const useStyles = makeStyles(theme => ({ chipInput: { minWidth: 300 }}));export default function StandaloneChipInput() { const classes = useStyles(); const [values, setValues] = useState([]); const onAdd = chip => { setValues([...values, chip]); }; const onDelete = (chip, index) => { setValues(values.slice(0, index).concat(values.slice(index + 1))); }; return ( <ChipInput className={classes.chipInput} helperText="Type ...Read now
Unlock full access