@material-ui/core
Version:
React components that implement Google's Material Design.
66 lines (61 loc) • 1.83 kB
TypeScript
import * as React from 'react';
import { StandardProps } from '..';
import { IconButtonProps } from '../IconButton';
export interface SwitchBaseProps
extends StandardProps<
IconButtonProps,
SwitchBaseClassKey,
'children' | 'onChange' | 'type' | 'value'
> {
autoFocus?: boolean;
/**
* If `true`, the component is checked.
*/
checked?: boolean;
checkedIcon: React.ReactNode;
defaultChecked?: boolean;
disabled?: boolean;
/**
* If `true`, the ripple effect will be disabled.
*/
disableRipple?: boolean;
icon: React.ReactNode;
/**
* The id of the `input` element.
*/
id?: string;
/**
* [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<any>;
/**
* Name attribute of the `input` element.
*/
name?: string;
/**
* 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;
readOnly?: boolean;
/**
* If `true`, the `input` element will be required.
*/
required?: boolean;
tabIndex?: number;
type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
/**
* The value of the component. The DOM API casts this to a string.
*/
value?: unknown;
}
export type SwitchBaseClassKey = 'root' | 'checked' | 'disabled' | 'input';
declare const SwitchBase: React.ComponentType<SwitchBaseProps>;
export default SwitchBase;