UNPKG

@porsche-design-system/components-react

Version:

Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.

153 lines (152 loc) 5.6 kB
import type { BaseProps } from '../../BaseProps'; import type { BreakpointCustomizable, CheckboxBlurEventDetail, CheckboxChangeEventDetail, CheckboxState } from '../types'; export type PCheckboxProps = BaseProps & { /** * Reflects the checkbox's current checked state and allows setting the initial checked value on load. * @default false */ checked?: boolean; /** * Reduces the checkbox size and spacing for a more compact layout. * @default false */ compact?: boolean; /** * Disables the checkbox, preventing all interaction. The value is not submitted with the form. * @default false */ disabled?: boolean; /** * Associates the checkbox with a form element by its ID when not directly nested inside it. */ form?: string; /** * Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. * @default false */ hideLabel?: BreakpointCustomizable<boolean>; /** * Puts the checkbox into an indeterminate state, indicating that a group of child items is only partially selected. * @default false */ indeterminate?: boolean; /** * Sets the visible label text displayed next to the checkbox. * @default '' */ label?: string; /** * @experimental Disables the checkbox and displays a loading spinner to indicate an ongoing operation. * @default false */ loading?: boolean; /** * Sets the validation feedback message displayed below the checkbox when `state` is `success` or `error`. * @default '' */ message?: string; /** * Sets the name submitted with the form data to identify this checkbox's value on the server. * @default '' */ name?: string; /** * Emitted when the checkbox loses focus. */ onBlur?: (event: CustomEvent<CheckboxBlurEventDetail>) => void; /** * Emitted when the user changes the checked state of the checkbox. */ onChange?: (event: CustomEvent<CheckboxChangeEventDetail>) => void; /** * Marks the checkbox as required — form submission is blocked unless the checkbox is checked. * @default false */ required?: boolean; /** * Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`). * @default 'none' */ state?: CheckboxState; /** * Sets the value submitted with the form data when the checkbox is checked. Unchecked checkboxes are excluded from form submissions. * @default 'on' */ value?: string; }; export declare const PCheckbox: import("react").ForwardRefExoticComponent<Omit<import("react").DOMAttributes<{}>, "onChange" | "onInput" | "onToggle"> & Pick<import("react").HTMLAttributes<{}>, "suppressHydrationWarning" | "autoFocus" | "className" | "dir" | "hidden" | "id" | "inert" | "inputMode" | "lang" | "slot" | "style" | "tabIndex" | "title" | "translate" | "role"> & { /** * Reflects the checkbox's current checked state and allows setting the initial checked value on load. * @default false */ checked?: boolean; /** * Reduces the checkbox size and spacing for a more compact layout. * @default false */ compact?: boolean; /** * Disables the checkbox, preventing all interaction. The value is not submitted with the form. * @default false */ disabled?: boolean; /** * Associates the checkbox with a form element by its ID when not directly nested inside it. */ form?: string; /** * Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. * @default false */ hideLabel?: BreakpointCustomizable<boolean>; /** * Puts the checkbox into an indeterminate state, indicating that a group of child items is only partially selected. * @default false */ indeterminate?: boolean; /** * Sets the visible label text displayed next to the checkbox. * @default '' */ label?: string; /** * @experimental Disables the checkbox and displays a loading spinner to indicate an ongoing operation. * @default false */ loading?: boolean; /** * Sets the validation feedback message displayed below the checkbox when `state` is `success` or `error`. * @default '' */ message?: string; /** * Sets the name submitted with the form data to identify this checkbox's value on the server. * @default '' */ name?: string; /** * Emitted when the checkbox loses focus. */ onBlur?: (event: CustomEvent<CheckboxBlurEventDetail>) => void; /** * Emitted when the user changes the checked state of the checkbox. */ onChange?: (event: CustomEvent<CheckboxChangeEventDetail>) => void; /** * Marks the checkbox as required — form submission is blocked unless the checkbox is checked. * @default false */ required?: boolean; /** * Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`). * @default 'none' */ state?: CheckboxState; /** * Sets the value submitted with the form data when the checkbox is checked. Unchecked checkboxes are excluded from form submissions. * @default 'on' */ value?: string; } & { children?: import("react").ReactNode | undefined; } & import("react").RefAttributes<HTMLElement>>;