diff --git a/.changeset/eighty-elephants-call.md b/.changeset/eighty-elephants-call.md new file mode 100644 index 0000000..c0a88f5 --- /dev/null +++ b/.changeset/eighty-elephants-call.md @@ -0,0 +1,5 @@ +--- +"@openfun/cunningham-react": patch +--- + +support ReactNode as input label diff --git a/packages/react/src/components/Forms/Checkbox/index.tsx b/packages/react/src/components/Forms/Checkbox/index.tsx index 5393052..dff2f3a 100644 --- a/packages/react/src/components/Forms/Checkbox/index.tsx +++ b/packages/react/src/components/Forms/Checkbox/index.tsx @@ -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 & diff --git a/packages/react/src/components/Forms/Radio/index.tsx b/packages/react/src/components/Forms/Radio/index.tsx index 42ec8e3..e93805d 100644 --- a/packages/react/src/components/Forms/Radio/index.tsx +++ b/packages/react/src/components/Forms/Radio/index.tsx @@ -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 &