A select input for tree shaped data.
npm install --save react-breadcrumb-select
You can take a look at the component on the example page.
importReactfrom"react";importReactDOMfrom"react-dom";importBreadcrumbSelectfrom"react-breadcrumb-select";constdata=[{id: 1,name: '',parent: null,children: [{id: 3,name: 'three',parent: 1,chlidren: [{id: 5,name: 'five',parent: 3,children: []}]},{id: 4,name: 'four',parent: 1,chlidren: [{id: 6,name: 'six',parent: 4,children: []}]}]},{id: 2,name: 'two',parent: null,chlidren: []}];functionExample(){consthandleChange=e=>{// Do some stuff...};return(<div><BreadcrumbSelectdata={data}onChange={handleChange}/></div>);}constapp=document.getElementById("app");ReactDOM.render(<Example/>,app);PropTypes.arrayOf(PropTypes.object) or PropTypes.object
Required
PropTypes.string
Select input plceholder text.
PropTypes.number
Id of the selected element. It will display the tree of selects.
PropTypes.func
Callback function when an element is selected.
PropTypes.string
Text to display when the search in a select input returns no results.
PropTypes.arrayOf(PropTypes.number)
Array of ids to disable. Elements will appear but with a disabled state.
PropTypes.shape({id: PropTypes.number,name: PropTypes.string,parent: PropTypes.number,// or nullchildren: PropTypes.arrayOf(PropTypes.object)})