UNPKG

next-gs

Version:

NPM package for building a React+NextJS+Prisma admin application.

25 lines (19 loc) 533 B
import React from "react"; import { Checkbox } from "semantic-ui-react"; import { FormSpy } from "react-final-form"; const FieldLabel = ({ text, checked, onToggle }) => { const renderLabel = (props) => { const check = checked(props); return ( <label> <Checkbox label={text} checked={check} onChange={() => onToggle(!check, props)} /> </label> ); }; return <FormSpy subscription={{ values: true }} render={renderLabel} />; }; export default FieldLabel;