import type { ReactElement, HTMLAttributes, Ref } from "react"; import type SlSwitchElement from "@shoelace-style/shoelace/dist/components/switch/switch.js"; import { SlBlurEvent, SlChangeEvent, SlInputEvent, SlFocusEvent, SlInvalidEvent, } from "../events"; export type { SlSwitchElement }; export type SlSwitchBlurEvent = SlBlurEvent; export type SlSwitchChangeEvent = SlChangeEvent; export type SlSwitchInputEvent = SlInputEvent; export type SlSwitchFocusEvent = SlFocusEvent; export type SlSwitchInvalidEvent = SlInvalidEvent; export interface SlSwitchProps extends HTMLAttributes { ref?: Ref; /** * */ title?: string; /** * The name of the switch, submitted as a name/value pair with form data. */ name?: string; /** * The current value of the switch, submitted as a name/value pair with form data. */ value?: string; /** * The switch's size. */ size?: "small" | "medium" | "large"; /** * Disables the switch. */ disabled?: boolean; /** * Draws the switch in a checked state. */ checked?: boolean; /** * By default, form controls are associated with the nearest containing `
` element. This attribute allows you * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in * the same document or shadow root for this to work. */ form?: string; /** * Makes the switch a required field. */ required?: boolean; /** * The switch's help text. If you need to display HTML, use the `help-text` slot instead. */ helpText?: string; /** * Emitted when the control loses focus. */ onSlBlur?: (event: SlSwitchBlurEvent) => void; /** * Emitted when the control loses focus. */ onSlBlurCapture?: (event: SlSwitchBlurEvent) => void; /** * Emitted when the control's checked state changes. */ onSlChange?: (event: SlSwitchChangeEvent) => void; /** * Emitted when the control's checked state changes. */ onSlChangeCapture?: (event: SlSwitchChangeEvent) => void; /** * Emitted when the control receives input. */ onSlInput?: (event: SlSwitchInputEvent) => void; /** * Emitted when the control receives input. */ onSlInputCapture?: (event: SlSwitchInputEvent) => void; /** * Emitted when the control gains focus. */ onSlFocus?: (event: SlSwitchFocusEvent) => void; /** * Emitted when the control gains focus. */ onSlFocusCapture?: (event: SlSwitchFocusEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalid?: (event: SlSwitchInvalidEvent) => void; /** * Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ onSlInvalidCapture?: (event: SlSwitchInvalidEvent) => void; } /** * Switches allow the user to toggle an option on or off. */ export default function SlSwitch( props: SlSwitchProps, ): ReactElement;