Last active
February 8, 2020 11:45
-
-
Save alexwhin/4209a8e4aa7d60a61818c0a307b6be19 to your computer and use it in GitHub Desktop.
Checkbox component for Formik (https://github.com/jaredpalmer/formik)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Field, FieldProps } from "formik"; | |
interface Props { | |
id: string; | |
name: string; | |
className: string; | |
} | |
export const Checkbox = ({ id, name, className }: Props): JSX.Element => ( | |
<Field | |
name={name} | |
render={({ field }: FieldProps) => ( | |
<input | |
id={id} | |
{...field} | |
type="checkbox" | |
className={className} | |
checked={field.value} | |
/> | |
)} | |
/> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment