@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
39 lines • 1.77 kB
TypeScript
import { type InputHTMLAttributes, type ReactNode } from "react";
import { type ValidationMessageProps } from "../validation-message";
import { type ErrorMessageProps } from "../error-message";
export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "size"> & {
children: ReactNode;
variant?: "plain" | "bounding-box";
title?: string;
validationMessage?: ReactNode | {
value: ReactNode;
};
validationMessageProps?: Partial<ValidationMessageProps>;
/** @deprecated Use `validationMessageProps` instead */
errorMessageProps?: Partial<ErrorMessageProps>;
size?: "small" | "";
} & ({
/**
* Set to `true` to add error styling. The component will take care of aria to indicate invalid state.
*
* Normally you don't need this, as you should wrap your Checkboxes in the Fieldset component.
* When providing an errorMessage to Fieldset, all contained Checkboxes will get correct hasError state.
*
* You can use this when your checkbox is part of a non-HDS fieldset which shows an error message.
*/
hasError?: boolean;
/** @deprecated Use `validationMessage` instead */
errorMessage?: never;
} | {
hasError?: never;
/**
* Set an error message to add error styling, and display the error message.
* The component will take care of aria to connect the error message to the checkbox.
*
* Use this when your checkbox is standalone (not part of a fieldset).
*/
/** @deprecated Use `validationMessage` instead */
errorMessage?: ReactNode;
});
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
//# sourceMappingURL=checkbox.d.ts.map