function createToggleWithInput
createToggleWithInput(options: CreateToggleOptions & { name: string; }): { toggle: HTMLElement; input: HTMLInputElement; }

Create a hidden checkbox input that syncs with a toggle Useful for form submissions

Examples

Example 1

const { toggle, input } = createToggleWithInput({ name: 'notifications', checked: true }); form.appendChild(input); form.appendChild(toggle);

Parameters

options: CreateToggleOptions & { name: string; }

Return Type

{ toggle: HTMLElement; input: HTMLInputElement; }

Usage

import { createToggleWithInput } from ".";