Skip to content

Commit 03f0a5c

Browse files
authored
Merge pull request #237 from codegouvfr/callout-fix
fix(CallOut): allow custom title tag
2 parents 374deb8 + 58d1f0d commit 03f0a5c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/CallOut.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type CallOutProps = {
1818
id?: string;
1919
iconId?: FrIconClassName | RiIconClassName;
2020
title?: ReactNode;
21+
titleAs?: `h${2 | 3 | 4 | 5 | 6}` | "p";
2122
buttonProps?: ButtonProps;
2223
colorVariant?: CallOutProps.ColorVariant;
2324
classes?: Partial<Record<"root" | "title" | "text" | "button", string>>;
@@ -41,6 +42,7 @@ export const CallOut = memo(
4142
className,
4243
iconId,
4344
title,
45+
titleAs: HtmlTitleTag = "h3",
4446
buttonProps,
4547
colorVariant,
4648
classes = {},
@@ -73,7 +75,9 @@ export const CallOut = memo(
7375
{...rest}
7476
>
7577
{title !== undefined && (
76-
<h3 className={cx(fr.cx("fr-callout__title"), classes.title)}>{title}</h3>
78+
<HtmlTitleTag className={cx(fr.cx("fr-card__title"), classes.title)}>
79+
{title}
80+
</HtmlTitleTag>
7781
)}
7882
<p className={cx(fr.cx("fr-callout__text"), classes.text)}> {children} </p>
7983
{buttonProps !== undefined && (

0 commit comments

Comments
 (0)