liber-salti
Version:
Saltí - Liber Design System
34 lines (33 loc) • 1.11 kB
TypeScript
/// <reference types="react" />
export interface SwitchProps {
/**
* If `true`, the component is checked.
*/
checked?: boolean;
/**
* The size of the switch.
* `small` is equivalent to the dense switch styling.
*/
size?: 'medium' | 'small';
/**
* If `true`, the component is disabled.
*/
disabled?: boolean;
/**
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes)
* applied to the `input` element.
*/
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
/**
* Pass a ref to the `input` element.
*/
inputRef?: React.Ref<HTMLInputElement>;
/**
* Callback fired when the state is changed.
*
* @param {object} event The event source of the callback.
* You can pull out the new value by accessing event.target.value (string).
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
*/
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
}