({
}),
});
+/** Card text to be displayed above title */
+const Overline = ({ children, className }: ChildProps) => {
+ const styles = useStyles2(getOverlineStyles);
+ return (
+
+ {children && (
+
+ {children}
+
+ )}
+
+ );
+};
+Overline.displayName = 'Overline';
+
+const getOverlineStyles = (theme: GrafanaTheme2) => ({
+ overline: css({
+ gridArea: 'Overline',
+ marginBottom: theme.spacing(0.5),
+ }),
+});
+
const Tags = ({ children, className }: ChildProps) => {
const styles = useStyles2(getTagStyles);
return {children}
;
@@ -349,6 +384,7 @@ export const getCardStyles = (theme: GrafanaTheme2) => {
};
};
+Card.Overline = Overline;
Card.Heading = Heading;
Card.Tags = Tags;
Card.Figure = Figure;
diff --git a/packages/grafana-ui/src/components/Card/CardContainer.tsx b/packages/grafana-ui/src/components/Card/CardContainer.tsx
index e4a52c9f1f2..430634f9ba7 100644
--- a/packages/grafana-ui/src/components/Card/CardContainer.tsx
+++ b/packages/grafana-ui/src/components/Card/CardContainer.tsx
@@ -70,7 +70,8 @@ export const getCardContainerStyles = (
theme: GrafanaTheme2,
disabled = false,
disableHover = false,
- isSelected?: boolean
+ isSelected?: boolean,
+ isCompact?: boolean
) => {
const isSelectable = isSelected !== undefined;
@@ -79,16 +80,17 @@ export const getCardContainerStyles = (
display: 'grid',
position: 'relative',
gridTemplateColumns: 'auto 1fr auto',
- gridTemplateRows: '1fr auto auto auto',
+ gridTemplateRows: 'auto 1fr auto auto auto',
gridAutoColumns: '1fr',
gridAutoFlow: 'row',
gridTemplateAreas: `
+ "Figure Overline Tags"
"Figure Heading Tags"
"Figure Meta Tags"
"Figure Description Tags"
"Figure Actions Secondary"`,
width: '100%',
- padding: theme.spacing(2),
+ padding: theme.spacing(isCompact ? 1 : 2),
background: theme.colors.background.secondary,
borderRadius: theme.shape.radius.default,
marginBottom: '8px',