🏷️(react) support ReactNode as input label

There are use cases that required to put links inside Checkboxes or
Radio inputs.
This commit is contained in:
Nathan Vasse
2023-11-24 15:50:10 +01:00
committed by NathanVss
parent 6b6c0ea942
commit e3882eb308
3 changed files with 9 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@openfun/cunningham-react": patch
---
support ReactNode as input label

View File

@@ -5,13 +5,14 @@ import React, {
useEffect,
useRef,
useState,
ReactNode,
} from "react";
import classNames from "classnames";
import { Field, FieldProps } from ":/components/Forms/Field";
export type CheckboxOnlyProps = {
indeterminate?: boolean;
label?: string;
label?: ReactNode;
};
export type CheckboxProps = InputHTMLAttributes<HTMLInputElement> &

View File

@@ -2,12 +2,13 @@ import React, {
InputHTMLAttributes,
PropsWithChildren,
forwardRef,
ReactNode,
} from "react";
import classNames from "classnames";
import { Field, FieldProps } from ":/components/Forms/Field";
export type RadioOnlyProps = {
label?: string;
label?: ReactNode;
};
export type RadioProps = InputHTMLAttributes<HTMLInputElement> &