@@ -4,6 +4,7 @@ import { Controller, useFormContext } from "react-hook-form";
44import type { z } from "zod" ;
55
66import { useLocale } from "@calcom/lib/hooks/useLocale" ;
7+ import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML" ;
78import classNames from "@calcom/ui/classNames" ;
89import { InfoBadge } from "@calcom/ui/components/badge" ;
910import { Label } from "@calcom/ui/components/form" ;
@@ -19,6 +20,19 @@ import {
1920} from "./useShouldBeDisabledDueToPrefill" ;
2021import { getTranslatedConfig as getTranslatedVariantsConfig } from "./utils/variantsConfig" ;
2122
23+ // helper to render markdown label safely
24+ const renderLabel = ( field : Partial < RhfFormField > ) => {
25+ if ( field . labelAsSafeHtml ) {
26+ return (
27+ < span
28+ // eslint-disable-next-line react/no-danger
29+ dangerouslySetInnerHTML = { { __html : markdownToSafeHTML ( field . labelAsSafeHtml ) } }
30+ />
31+ ) ;
32+ }
33+ return < span > { field . label } </ span > ;
34+ } ;
35+
2236type RhfForm = {
2337 fields : z . infer < typeof fieldsSchema > ;
2438} ;
@@ -155,7 +169,7 @@ const WithLabel = ({
155169 field . label && (
156170 < div className = "mb-2 flex items-center" >
157171 < Label className = "!mb-0 flex items-center" htmlFor = { htmlFor } >
158- < span > { field . label } </ span >
172+ { renderLabel ( field ) }
159173 < span className = "text-emphasis -mb-1 ml-1 text-sm font-medium leading-none" >
160174 { ! readOnly && field . required ? "*" : "" }
161175 </ span >
0 commit comments