jsketcher/modules/ui/components/controls/CheckboxControl.jsx
2022-08-15 23:47:20 -07:00

12 lines
376 B
JavaScript

import React, {useContext} from 'react';
import {FieldId} from "ui/components/controls/Field";
export default function CheckboxControl(props) {
const {onChange, value} = props;
const fieldId = useContext(FieldId);
return <input id={fieldId}
type='checkbox'
checked={value}
onChange={e => onChange(e.target.checked)}/>
}