import * as React from "react"; import * as System from "~/components/system"; import * as Constants from "~/common/constants"; import Group from "~/components/system/Group"; import SystemPage from "~/components/system/SystemPage"; import ViewSourceLink from "~/components/system/ViewSourceLink"; import CodeBlock from "~/components/system/CodeBlock"; 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.
{`class ExampleOne extends React.Component { state = { flavors: [ "Chocolate", "Vanilla", "Mint Chip", "Pistachio", "Neapolitan", "Toffee", "Rocky Road", ], }; _handleChange = (e) => { this.setState({ [e.target.name]: e.target.value }); }; render() { return ( ); } }`}


Accepted React Properties

onChange ), b: "function", c: "null", d: "Function called upon an onChange event", }, { id: 2, 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: 3, a: "name", b: "string", c: "null", d: "Input name", }, { id: 4, a: "label", b: "string", c: "null", d: "Label text", }, { id: 5, a: "description", b: "string", c: "null", d: "Description text", }, { id: 6, a: "tooltip", b: "string", c: "null", d: "Tooltip text", }, ], }} />
); } }