mksingh
componentjsonforms-boolean-controlsource: ok · hit
Jsonforms Boolean Control
JSONForms checkbox renderer for boolean type fields.
npx shadcn add "https://mksingh.dev/r/jsonforms-boolean-control.json"free
No selection tags yet — empty means no evidence, not lack of support.
Dependencies
Bundle weight · light@jsonforms/core@jsonforms/react
Registry dependencies
https://mksingh.dev/r/typography.jsoncheckboxlabel
Files1 · source cached 10/14/2026, 11:39:47 AM
registry/forms/renderers/boolean-control.tsx
import { useState } from 'react';
import { ControlProps, isBooleanControl, rankWith } from '@jsonforms/core';
import { withJsonFormsControlProps } from '@jsonforms/react';
import Typography from '~/components/ui/typography';
import { Checkbox } from '~/components/ui/checkbox';
import { Label } from '~/components/ui/label';
import { shouldShowError } from '~/components/forms/utils';
const BooleanControlRenderer = (props: ControlProps) => {
const { label, data, handleChange, path, visible, enabled, id, errors, config } = props;
const [touched, setTouched] = useState(false);
if (!visible) return null;
return (
<div className="flex flex-col gap-1 py-2">
<div className="flex items-center gap-2">
<Checkbox
id={id}
checked={data ?? false}
onCheckedChange={checked => handleChange(path, checked)}
onBlur={() => setTouched(true)}
disabled={!enabled}
/>
{label && (
<Label htmlFor={id} className="text-xs font-medium text-foreground cursor-pointer">
{label}
</Label>
)}
</div>
{shouldShowError(config, touched) && errors && <Typography variant="error">{errors.split("\n")[0]}</Typography>}
</div>
);
};
export const booleanControlTester = rankWith(10, isBooleanControl);
export default withJsonFormsControlProps(BooleanControlRenderer);
More from mksingh
Jsonforms Anyof String Or Enum ControlcomponentJsonforms Array LayoutcomponentJsonforms Boolean CellcomponentJsonforms Boolean Toggle CellcomponentJsonforms Boolean Toggle ControlcomponentJsonforms CategorizationcomponentJsonforms Controlcomponent
Browse all components in this library →