import type { HTMLInputAttributes } from 'svelte/elements'; import type { MintProp } from '../../mint/index.js'; import type { InteractiveTier } from '../../utils/index.js'; import type { ToggleSlots, ToggleVariants } from './toggle.variants.js'; /** * @summary On or off, with the switch to say which. * @description Accessible switch control for boolean on/off states. * Built on a hidden native input with semantic intents and Mint micro-interactions. * * @tag form * @related Checkbox * * @example * ```svelte * * ``` * * @example * ```svelte * console.log('toggled', val)} * /> * ``` * * @example * ```svelte *
* * *
* ``` */ export interface ToggleProps extends Omit, Omit { /** Current on/off state. Supports two-way binding via `bind:checked`. */ checked?: boolean; /** Text label displayed to the right of the toggle track. */ label?: string; /** Helper text shown below the control. Hidden when `error` is set. Useful for explaining side-effects of the toggle. */ helper?: string; /** * Error message shown below the control. Replaces `helper`, flags the * hidden input `aria-invalid`, and marks the unchecked track with the * danger colour — e.g. for a consent toggle that must be switched on. * @summary Error message under the control; also marks the off state with the danger colour. */ error?: string; /** Prevent interaction and dim the control. */ disabled?: boolean; /** Mark the native input as required for form validation. */ required?: boolean; /** The `name` attribute of the underlying ``. Used for form submission. */ name?: string; /** The value submitted when checked. Defaults to `'on'`. */ value?: string; /** Extra classes merged onto the outermost wrapper element. */ class?: string; /** Strip all default variant classes. Use with `slotClasses` for a fully custom look. The track exposes `data-state` for conditional styling. */ unstyled?: boolean; /** * Per-slot class overrides merged with (or replacing, when `unstyled`) the * default styles. Slots: wrapper (root — what `class` also targets) | control * (the `