import * as React from "react"; import styled from "styled-components"; import { useField } from "formik"; import { ToggleSwitch, BaseLabel, Label, ErrorLabel, Box, Col } from "./index"; import { StructureProps } from "./system/unions"; type ManagedToggleSwitchFieldProps = StructureProps & { caption?: string; label: string; id: string; disabled?: boolean; }; // Hide this input completely const HiddenInput = styled.input` position: absolute; opacity: 0; height: 0; width: 0; margin: 0px; `; export const ManagedToggleSwitchField = ({ label, caption, id, disabled, ...props }: ManagedToggleSwitchFieldProps) => { const [field, meta] = useField({ name: id, type: "checkbox" }); return ( {caption ? ( ) : null} {meta.error} ); };