Skip to content

Instantly share code, notes, and snippets.

@alexwhin alexwhin/Checkbox.tsx
Last active Feb 8, 2020

Embed
What would you like to do?
Checkbox component for Formik (https://github.com/jaredpalmer/formik)
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
You can’t perform that action at this time.