import * as React from "react"; import * as System from "~/components/system"; import * as Constants from "~/common/constants"; import moment from "moment"; import Group from "~/components/system/Group"; import SystemPage from "~/components/system/SystemPage"; import ViewSourceLink from "~/components/system/ViewSourceLink"; export default class SystemPageListEditor extends React.Component { state = { flavors: [ "Chocolate", "Vanilla", "Mint Chip", "Pistachio", "Neapolitan", "Toffee", "Rocky Road", ], }; _handleListChange = ({ name, value }) => { this.setState({ [name]: value }); }; render() { return ( List Editor

The List Editor component allows the user to add to, delete from, and reorder a list of strings.


Imports

Import React and the ListEditor Component.

{`import * as React from 'react'; import { ListEditor } from 'slate-react-system';`}

List Editor


Define the List Editor component. Note that the _handleListChange takes a different shape than the other onChange functions in this design system.
{`class ExampleOne extends React.Component { state = { flavors: [ "Chocolate", "Vanilla", "Mint Chip", "Pistachio", "Neapolitan", "Toffee", "Rocky Road" ] } _handleListChange = ({ name, value }) => { this.setState({ [name]: value }); }; render() { return( ) } }`}


Accepted React Properties

onChange ), b: function, c: "null", d: "Function called upon an onChange event", }, { id: 6, a: ( options ), b: Array, c: "null", d: "Values to choose from and reorder. Can be used to specify the default value. An array of strings.", }, { id: 2, a: "name", b: string, c: "null", d: "Input name", }, { id: 3, a: "label", b: string, c: "null", d: "Label text", }, { id: 4, a: "description", b: string, c: "null", d: "Description text", }, { id: 5, a: "tooltip", b: string, c: "null", d: "Tooltip text", }, ], }} />
); } }