From 53030e7960b4bf2daadb1ffcca9a065e0e42e464 Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Fri, 7 Feb 2025 16:39:13 +0200 Subject: [PATCH] Card: Render description element based on children type (#100276) --- packages/grafana-ui/src/components/Card/Card.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/grafana-ui/src/components/Card/Card.tsx b/packages/grafana-ui/src/components/Card/Card.tsx index 0920106d21d..7171b78b08a 100644 --- a/packages/grafana-ui/src/components/Card/Card.tsx +++ b/packages/grafana-ui/src/components/Card/Card.tsx @@ -183,7 +183,8 @@ const getTagStyles = (theme: GrafanaTheme2) => ({ /** Card description text */ const Description = ({ children, className }: ChildProps) => { const styles = useStyles2(getDescriptionStyles); - return
{children}
; + const Element = typeof children === 'string' ? 'p' : 'div'; + return {children}; }; Description.displayName = 'Description';