@commercetools-uikit/checkbox-input
Version:
An input component that works as checkbox input.
57 lines (56 loc) • 1.91 kB
TypeScript
import type { ChangeEventHandler, ReactNode } from 'react';
export type TCheckboxProps = {
/**
* Used as HTML id attribute. An id is auto-generated when it is not specified.
*/
id?: string;
/**
* Used as HTML name attribute of the input component
*/
name?: string;
/**
* Value of the input component.
*/
value?: string;
/**
* The checked property sets the checked state of the checkbox.
*/
isChecked?: boolean;
/**
* If `true`, this state is shown as a dash in the checkbox, and indicates that its state is neither checked nor unchecked.
* This is most often used when the checkbox is tied to a collection of items in mixed states (E.g nested checkboxes).
* This takes precedence visually in case `isChecked` is marked as `true`
*/
isIndeterminate?: boolean;
/**
* Will be triggered whenever an `CheckboxInput` is clicked. Called with `event`
*/
onChange: ChangeEventHandler<HTMLInputElement>;
/**
* Forces CheckboxInput to be rendered in a hovered state.
* Needed for cases when hovered appearance should be triggered by the parent component and not the CheckboxInput itself.
* CheckboxInput is capable of handling it's own hovering without the need to pass this prop.
*/
isHovered?: boolean;
/**
* Disables the CheckboxInput
*/
isDisabled?: boolean;
/**
* Makes the CheckboxInput readonly
*/
isReadOnly?: boolean;
/**
* Indicates that the checkbox has an error
*/
hasError?: boolean;
/**
* The descriptive text of the CheckboxInput, used as its label.
*/
children?: ReactNode;
};
declare const CheckboxInput: {
({ isChecked, isDisabled, hasError, ...props }: TCheckboxProps): import("@emotion/react/jsx-runtime").JSX.Element;
displayName: string;
};
export default CheckboxInput;