@aliretail/react-materials-components
Version:
29 lines (25 loc) • 646 B
Markdown
title: Switch
order: 60
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { FormComponents } from '@aliretail/react-materials-components';
const { Switch, SchemaForm, SchemaMarkupField: Field, createFormActions } = FormComponents;
const App = () => {
return (
<SchemaForm
components={{ Switch }}
onChange={console.log}
defaultValue={{
readOnly: true,
}}
>
<Field x-component="Switch" title="Switch" name="Switch" />
<Field x-component="Switch" title="readOnly" name="readOnly" readOnly />
</SchemaForm>
);
};
ReactDOM.render(<App />, mountNode);
```