@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
30 lines • 1.37 kB
TypeScript
import { type InputHTMLAttributes, type ReactNode } from "react";
import { type ErrorMessageProps } from "../error-message";
export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, "defaultValue"> & {
children: ReactNode;
variant?: "plain" | "bounding-box";
title?: string;
errorMessageProps?: Partial<ErrorMessageProps>;
} & ({
/**
* 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;
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).
*/
errorMessage?: ReactNode;
});
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
//# sourceMappingURL=checkbox.d.ts.map