UNPKG

1.32 kBTypeScriptView Raw
1import { type HTMLInputProps } from "../../common/props";
2import { type CardProps } from "../card/card";
3import type { CheckedControlProps, ControlProps } from "../forms/controlProps";
4export type ControlKind = "switch" | "checkbox" | "radio";
5/**
6 * Subset of {@link CardProps} which can be used to adjust its behavior.
7 */
8type SupportedCardProps = Omit<CardProps, "interactive" | "onChange">;
9/**
10 * Subset of {@link ControlProps} which can be used to adjust its behavior.
11 */
12type SupportedControlProps = Pick<ControlProps, keyof CheckedControlProps | "alignIndicator" | "disabled" | "inputRef" | "label" | "value">;
13/**
14 * Shared props interface for all control card components, including `CheckboxCard`, `RadioCard`, and `SwitchCard`.
15 * The label content may be specified as either `label` or `children`, but not both.
16 */
17export interface ControlCardProps extends SupportedCardProps, SupportedControlProps {
18 /**
19 * Which kind of form control to render inside the card.
20 */
21 controlKind: ControlKind;
22 /**
23 * HTML input attributes to forward to the control `<input>` element.
24 */
25 inputProps?: HTMLInputProps;
26 /**
27 * Whether the component should use "selected" Card styling when checked.
28 *
29 * @default true
30 */
31 showAsSelectedWhenChecked?: boolean;
32}
33export {};