UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

34 lines (33 loc) 1.72 kB
import React from "react"; import { MarginProps } from "styled-system"; import { CommonCheckableInputProps } from "../../__internal__/checkable-input"; import { TagProps } from "../../__internal__/utils/helpers/tags"; export interface SwitchProps extends Omit<CommonCheckableInputProps, "defaultChecked">, MarginProps, TagProps { /** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */ adaptiveLabelBreakpoint?: number; /** When true label is inline */ labelInline?: boolean; /** Triggers loading animation */ loading?: boolean; /** [Legacy] When true, validation icon will be placed on label instead of being placed on the input */ validationOnLabel?: boolean; /** The value of the switch, passed on form submit */ value?: string; /** [Legacy] Overrides the default tooltip position */ tooltipPosition?: "top" | "bottom" | "left" | "right"; /** [Legacy] Aria label for rendered help component */ helpAriaLabel?: string; /** Whether this component resides on a dark background */ isDarkBackground?: boolean; /** Render the ValidationMessage above the Switch input when validationRedesignOptIn flag is set */ validationMessagePositionTop?: boolean; /** Label width, as a percentage, when labelInline is true */ labelWidth?: number; /** OnChange event handler */ onChange: (ev: React.ChangeEvent<HTMLInputElement>) => void; /** Checked state of the input */ checked: boolean; } declare const SwitchComponent: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>; export { SwitchComponent as Switch }; export default SwitchComponent;