import type { HTMLInputAttributes } from 'svelte/elements'; import type { MintProp } from '../../mint/index.js'; import type { InteractiveTier } from '../../utils/index.js'; import type { CheckboxSlots, CheckboxVariants } from './checkbox.variants.js'; /** * @summary A box you tick, including the half-ticked state for partial selections. * @description Accessible checkbox with indeterminate support, semantic intents, and form integration. * Uses a hidden native input for correct form behavior and ARIA semantics. * * @tag form * @related Toggle * @related RadioGroup * * @example * ```svelte * * ``` * * @example * ```svelte * console.log(val)} * /> * ``` * * @example * ```svelte *
* * *
* ``` */ export interface CheckboxProps extends Omit, Omit { /** Current checked state. Supports two-way binding via `bind:checked`. */ checked?: boolean; /** * Visual-only third state showing a dash icon. Resets to unchecked on next * user toggle. Does not affect the submitted form value. Supports * `bind:indeterminate`. * @summary Visual-only third state showing a dash; the submitted value stays unchecked. */ indeterminate?: boolean; /** Text label displayed to the right of the checkbox box. */ label?: string; /** Hint text shown below the control. Hidden when `error` is set. */ helper?: string; /** Error message that replaces `helper`, styles the message red, and sets `aria-invalid` on the input. */ 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 wrapper element. */ class?: string; /** Strip all default variant classes. Use with `slotClasses` for a fully custom look. The box 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 | * box | icon | label | message. */ slotClasses?: Partial>; /** * Apply a named preset registered via ``. * Prefer this over `class` overrides when the requested look falls outside the * semantic intent palette — presets keep hover/active/dark-mode logic coherent * and make the custom look reusable across the project. */ preset?: string; /** * Micro-interaction preset applied to the box (the visible control, not * the sr-only input). Click-triggered engine mints listen on the * surrounding label; `ripple` ignites only on the box itself. Only * applies while not disabled. * @default 'none' * @summary Decorative feedback effect on the checkbox box. */ mint?: MintProp; /** Fired after the checked state changes. Receives the new `checked` value. */ onCheckedChange?: (checked: boolean) => void; /** Explicit `id` to link `