@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
48 lines • 1.9 kB
TypeScript
import { forwardRef } from "react";
import type { FieldsetHTMLAttributes, ReactNode, CSSProperties, ComponentProps } from "react";
import { type ValidationMessageProps } from "../validation-message";
import { type ErrorMessageProps } from "../error-message";
import { FieldsetDescription } from "./fieldset-description";
import { FieldsetLegend } from "./fieldset-legend";
type FieldsetLegendProps = ComponentProps<typeof FieldsetLegend>;
export interface FieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetElement> {
className?: string;
style?: CSSProperties;
"data-color"?: "info" | "success" | "warning" | "error";
validationMessage?: ReactNode | {
value: ReactNode;
};
validationMessageProps?: Partial<ValidationMessageProps>;
/**
* Providing an errorMessage will also give contained Checkboxes or Radio buttons
* error styling and aria to indicate invalid state.
*
* For Radio buttons you are even better off using RadioGroup.
*/
/** @deprecated Use `validationMessage` instead */
errorMessage?: ReactNode;
/**
* @deprecated Pass props directly to <Fieldset.Legend> instead.
*/
legendProps?: FieldsetLegendProps;
/**
* @deprecated Use <Fieldset.Legend>...</Fieldset.Legend> instead.
*/
legend?: ReactNode;
size?: "small" | "";
children: ReactNode;
/** @deprecated Use `validationMessageProps` instead */
errorMessageProps?: Partial<ErrorMessageProps>;
}
/** @deprecated Will no longer be needed */
export declare const useFieldsetContext: () => {
hasError: boolean;
size: "small" | "";
};
export declare const Fieldset: FieldsetType;
type FieldsetType = ReturnType<typeof forwardRef<HTMLFieldSetElement, FieldsetProps>> & {
Description: typeof FieldsetDescription;
Legend: typeof FieldsetLegend;
};
export {};
//# sourceMappingURL=fieldset.d.ts.map