UNPKG

@aliretail/react-materials-components

Version:
60 lines (55 loc) 1.32 kB
--- title: CheckedAll order: 102 --- 自动添加 "全部" 功能的 CheckboxGroup ```jsx import React from 'react'; import ReactDOM from 'react-dom'; import { FormComponents } from '@aliretail/react-materials-components'; const { CheckedAll, SchemaForm, SchemaMarkupField: Field } = FormComponents; const App = () => { return ( <SchemaForm components={{ CheckedAll, }} onChange={console.log} defaultValue={{ readOnly: '2', }} > <Field x-component="CheckedAll" title="Simple Checkbox" name="Checkbox" enum={['1', '2', '3', '4']} /> <Field x-component="CheckedAll" title="CheckboxGroup" name="CheckboxGroup" enum={[ { label: 'One', value: '1' }, { label: 'Two', value: '2' }, { label: 'Three', value: '3' }, { label: 'Four', value: '4' }, ]} /> <Field x-component="CheckedAll" title="readOnly" name="readOnly" readOnly enum={[ { label: 'One', value: '1' }, { label: 'Two', value: '2' }, { label: 'Three', value: '3' }, { label: 'Four', value: '4' }, ]} /> </SchemaForm> ); }; ReactDOM.render(<App />, mountNode); ```