import { Checkbox, Switch } from '@mantine/core'; import { BooleanNode, DefaultNodeOptions, WidgetField, WidgetPlugin, widget } from '@sagold/react-json-editor'; import { widgetInputProps } from '../../components/widgetInputProps'; export const BooleanWidget = widget(({ node, options, setValue }) => { const Input = node.schema.format === 'switch' ? Switch : Checkbox; return ( setValue(e.currentTarget.checked)} /> ); }); export const BooleanWidgetPlugin: WidgetPlugin = { id: 'boolean-widget', use: (node) => node.schema.type === 'boolean', Widget: BooleanWidget };