Card: Render description element based on children type (#100276)

pull/100278/head
Alex Khomenko 5 months ago committed by GitHub
parent dfaa12b800
commit 53030e7960
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      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 <div className={cx(styles.description, className)}>{children}</div>;
const Element = typeof children === 'string' ? 'p' : 'div';
return <Element className={cx(styles.description, className)}>{children}</Element>;
};
Description.displayName = 'Description';

Loading…
Cancel
Save