UNPKG

@syncfusion/react-buttons

Version:

Syncfusion React Buttons package is a feature-rich collection of UI components including Button, CheckBox, RadioButton, Switch, Chip, and more for building modern, interactive React applications.

126 lines (125 loc) 3.99 kB
import { InputHTMLAttributes } from 'react'; import { Color, Size, Position } from '@syncfusion/react-base'; /** * Interface for Checkbox change event arguments */ export interface CheckboxChangeEvent { /** * The initial event object received from the input element. */ event: React.ChangeEvent<HTMLInputElement>; /** * The current checked state of the Checkbox. */ value: boolean; } /** * Properties interface for the Checkbox component * */ export interface CheckboxProps { /** * Specifies if the Checkbox is in an `indeterminate` state, which visually presents it as neither checked nor unchecked; setting this to `true` will make the Checkbox appear in an indeterminate state. * * @default false */ indeterminate?: boolean; /** * Defines the text label for the Checkbox component, helping users understand its purpose. * * @default - */ label?: string; /** * Specifies the size style of the Checkbox. Options include 'Small', 'Medium' and 'Large'. * * @default Size.Medium */ size?: Size; /** * Specifies a custom icon to be displayed in unchecked state. This replaces the default Checkbox appearance. * * @default - */ icon?: React.ReactNode; /** * Specifies a custom icon to be displayed in checked state. This replaces the default Checkbox check mark. * * @default - */ checkedIcon?: React.ReactNode; /** * Specifies a custom icon to be displayed in the indeterminate state. This replaces the default indeterminate icon. * * @default - */ indeterminateIcon?: React.ReactNode; /** * Specifies the position of the label relative to the Checkbox. It determines whether the label appears before or after the Checkbox element in the UI. * * @default Position.Right */ labelPlacement?: Position; /** * Specifies a value that indicates whether the Checkbox is `checked` or not. When set to `true`, the Checkbox will be in `checked` state. * * @default false */ checked?: boolean; /** * Specifies the initial checked state of the Checkbox. Use for uncontrolled components. * * @default false */ defaultChecked?: boolean; /** * Specifies the Color style of the button. Options include 'Primary', 'Secondary', 'Warning', 'Success', 'Error', and 'Info'. * * @default Color.Primary */ color?: Color; /** * Defines `value` attribute for the Checkbox. It is a form data passed to the server when submitting the form. * * * @default - */ value?: string; /** * Triggers when the Checkbox state has been changed by user interaction, allowing custom logic to be executed in response to the state change. * * @event onChange */ onChange?: (event: CheckboxChangeEvent) => void; } /** * Interface to define the structure of the Checkbox component reference instance * */ export interface ICheckbox extends CheckboxProps { /** * This is Checkbox component element. * * @private * @default null */ element?: HTMLElement | null; } type ICheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size'> & ICheckbox; /** * The Checkbox component allows users to select one or multiple options from a list, providing a visual representation of a binary choice with states like checked, unchecked, or indeterminate. * * ```typescript * import { Checkbox } from "@syncfusion/react-buttons"; * * <Checkbox checked={true} label="Accept Terms and Conditions" /> * ``` */ export declare const Checkbox: React.ForwardRefExoticComponent<ICheckboxProps & React.RefAttributes<ICheckbox>>; export default Checkbox; interface CSSCheckboxProps { className?: string; checked?: boolean; label?: string; } export declare const CSSCheckbox: React.FC<CSSCheckboxProps>;