From 0e8980235f302d13e3dcfa6bd379d79a5ed767ab Mon Sep 17 00:00:00 2001
From: Kim Doberstein
Date: Fri, 18 Sep 2026 13:23:46 -0500
Subject: [PATCH 1/2] feat: add optional widget header info icon
Allow widgets to show clickable header help via config.info, opening a popover by default or a modal for longer content.
Co-authored-by: Cursor
---
README.md | 7 +-
.../content/examples/BasicExample.tsx | 18 ++++-
.../content/examples/CustomToolbarExample.tsx | 4 +
.../patternfly-docs/content/examples/basic.md | 31 +++++++
packages/module/src/WidgetLayout/GridTile.tsx | 59 +++++++++++++-
.../WidgetLayout/__tests__/GridTile.test.tsx | 81 +++++++++++++++++++
packages/module/src/WidgetLayout/types.ts | 14 +++-
7 files changed, 208 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index e425093..7c6945f 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,12 @@ const widgetMapping: WidgetMapping = {
defaults: { w: 2, h: 3, maxH: 6, minH: 2 },
config: {
title: 'Example Widget',
- icon:
+ icon: ,
+ // Optional: header info icon (popover by default; use variant: 'modal' for longer content)
+ info: {
+ title: 'About this widget',
+ content: Short help text explaining what this widget shows.
+ }
},
renderWidget: (id) => Widget content goes here
}
diff --git a/packages/module/patternfly-docs/content/examples/BasicExample.tsx b/packages/module/patternfly-docs/content/examples/BasicExample.tsx
index a0b3022..c8c20f7 100644
--- a/packages/module/patternfly-docs/content/examples/BasicExample.tsx
+++ b/packages/module/patternfly-docs/content/examples/BasicExample.tsx
@@ -122,6 +122,17 @@ const widgetMapping: WidgetMapping = {
headerLink: {
title: 'View full report',
href: '#'
+ },
+ // Longer help content — opens in a modal
+ info: {
+ title: 'About Recent Activity',
+ content: (
+ <>
+ This widget lists recent deployments and infrastructure changes.
+ Entries are ordered newest first. Use the footer link to open the full activity report.
+ >
+ ),
+ variant: 'modal',
}
},
renderWidget: () =>
@@ -130,7 +141,12 @@ const widgetMapping: WidgetMapping = {
defaults: { w: 1, h: 3, maxH: 6, minH: 2 },
config: {
title: 'Notifications',
- icon:
+ icon: ,
+ // Short help content — opens in a popover (default)
+ info: {
+ title: 'About Notifications',
+ content: Shows alerts, maintenance windows, and available patches that need attention.
,
+ }
},
renderWidget: () =>
}
diff --git a/packages/module/patternfly-docs/content/examples/CustomToolbarExample.tsx b/packages/module/patternfly-docs/content/examples/CustomToolbarExample.tsx
index 5f8436c..0361dd1 100644
--- a/packages/module/patternfly-docs/content/examples/CustomToolbarExample.tsx
+++ b/packages/module/patternfly-docs/content/examples/CustomToolbarExample.tsx
@@ -155,6 +155,10 @@ const widgetMapping: WidgetMapping = {
config: {
title: 'Notifications',
icon: ,
+ info: {
+ title: 'About Notifications',
+ content: Shows alerts, maintenance windows, and available patches that need attention.
,
+ },
},
renderWidget: () => ,
},
diff --git a/packages/module/patternfly-docs/content/examples/basic.md b/packages/module/patternfly-docs/content/examples/basic.md
index 8673bb6..0e09322 100644
--- a/packages/module/patternfly-docs/content/examples/basic.md
+++ b/packages/module/patternfly-docs/content/examples/basic.md
@@ -94,13 +94,34 @@ const widgetMapping: WidgetMapping = {
headerLink: {
title: 'View details',
href: '/details'
+ },
+ // Optional header info icon — popover by default
+ info: {
+ title: 'About this widget',
+ content: Short help text explaining what this widget shows.
}
},
renderWidget: (id) =>
+ },
+ 'detailed-widget': {
+ defaults: { w: 2, h: 4, maxH: 8, minH: 3 },
+ config: {
+ title: 'Detailed Widget',
+ // Use variant: 'modal' when the help content is long
+ info: {
+ title: 'Detailed information',
+ content: Longer help content that needs more space…
,
+ variant: 'modal',
+ ariaLabel: 'Detailed widget help'
+ }
+ },
+ renderWidget: (id) =>
}
};
```
+When `config.info` is set, an info icon appears in the widget header actions. Clicking it opens a **popover** by default, or a **modal** when `variant: 'modal'` is set.
+
### Widget configuration options
| Property | Type | Description |
@@ -112,8 +133,18 @@ const widgetMapping: WidgetMapping = {
| `config.title` | `string` | Widget title displayed in the header |
| `config.icon` | `ReactNode` | Icon displayed next to the title |
| `config.headerLink` | `{ title: string, href: string }` | Optional link displayed in the widget header |
+| `config.info` | `WidgetInfo` | Optional header info icon; see below |
| `renderWidget` | `(id: string) => ReactNode` | Function that renders the widget content |
+### Widget info (`config.info`)
+
+| Property | Type | Description |
+|----------|------|-------------|
+| `content` | `ReactNode` | Body content shown in the popover or modal (required) |
+| `title` | `ReactNode` | Optional header/title for the popover or modal |
+| `variant` | `'popover' \| 'modal'` | Presentation style. Defaults to `'popover'`. Use `'modal'` for longer content |
+| `ariaLabel` | `string` | Accessible label for the info icon button. Defaults to `"More information"` |
+
## Template configuration
Define your initial layout using the `ExtendedTemplateConfig` type:
diff --git a/packages/module/src/WidgetLayout/GridTile.tsx b/packages/module/src/WidgetLayout/GridTile.tsx
index f57fa62..46ce43d 100644
--- a/packages/module/src/WidgetLayout/GridTile.tsx
+++ b/packages/module/src/WidgetLayout/GridTile.tsx
@@ -12,6 +12,10 @@ import {
Icon,
MenuToggle,
MenuToggleElement,
+ Modal,
+ ModalBody,
+ ModalHeader,
+ Popover,
Skeleton,
Tooltip,
} from '@patternfly/react-core';
@@ -19,13 +23,14 @@ import CompressIcon from '@patternfly/react-icons/dist/esm/icons/compress-icon';
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
+import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
import LockIcon from '@patternfly/react-icons/dist/esm/icons/lock-icon';
import MinusCircleIcon from '@patternfly/react-icons/dist/esm/icons/minus-circle-icon';
import UnlockIcon from '@patternfly/react-icons/dist/esm/icons/unlock-icon';
import React, { useMemo, useState } from 'react';
import clsx from 'clsx';
import type { LayoutItem } from 'react-grid-layout';
-import { ExtendedLayoutItem, WidgetConfiguration, AnalyticsTracker } from './types';
+import { ExtendedLayoutItem, WidgetConfiguration, WidgetInfo, AnalyticsTracker } from './types';
export type SetWidgetAttribute = (id: string, attributeName: keyof ExtendedLayoutItem, value: T) => void;
@@ -46,6 +51,53 @@ export type GridTileProps = React.PropsWithChildren<{
analytics?: AnalyticsTracker;
}>;
+const WidgetInfoAction = ({ info }: { info: WidgetInfo }) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const ariaLabel = info.ariaLabel ?? 'More information';
+ const accessibleName = typeof info.title === 'string' ? info.title : ariaLabel;
+ const isModal = info.variant === 'modal';
+
+ const trigger = (
+
+ );
+
+ if (isModal) {
+ return (
+ <>
+ {trigger}
+ setIsModalOpen(false)}
+ variant="medium"
+ aria-label={accessibleName}
+ >
+ {info.title != null && }
+ {info.content}
+
+ >
+ );
+ }
+
+ return (
+ document.body}
+ aria-label={accessibleName}
+ >
+ {trigger}
+
+ );
+};
+
const GridTile = ({
widgetType,
isDragging,
@@ -58,8 +110,8 @@ const GridTile = ({
analytics,
}: GridTileProps) => {
const [isOpen, setIsOpen] = useState(false);
- const { headerLink } = widgetConfig.config || {};
- const hasHeader = headerLink && headerLink.href && headerLink.title;
+ const { headerLink, info } = widgetConfig.config || {};
+ const hasHeader = headerLink?.href && headerLink?.title;
const [linkHref, linkTarget] = useMemo(() => {
if (!headerLink?.href) {
@@ -133,6 +185,7 @@ const GridTile = ({
const headerActions = (
<>
+ {info ? : null}
{
expect(screen.getByText('test-widget')).toBeInTheDocument();
});
});
+
+describe('GridTile - info action', () => {
+ it('does not render info button when info is not configured', () => {
+ render();
+ expect(screen.queryByRole('button', { name: 'More information' })).not.toBeInTheDocument();
+ });
+
+ it('opens a popover with content on click by default', async () => {
+ const user = userEvent.setup();
+ render(
+ Short help text
,
+ },
+ },
+ },
+ })}
+ />
+ );
+
+ await user.click(screen.getByRole('button', { name: 'More information' }));
+ expect(await screen.findByText('Short help text')).toBeInTheDocument();
+ expect(screen.getByText('About this widget')).toBeInTheDocument();
+ });
+
+ it('opens a modal with content when variant is modal', async () => {
+ const user = userEvent.setup();
+ render(
+ Long form help content,
+ variant: 'modal',
+ },
+ },
+ },
+ })}
+ />
+ );
+
+ expect(screen.queryByText('Long form help content')).not.toBeInTheDocument();
+ await user.click(screen.getByRole('button', { name: 'More information' }));
+ expect(await screen.findByText('Long form help content')).toBeInTheDocument();
+ expect(screen.getByText('Detailed info')).toBeInTheDocument();
+
+ await user.click(screen.getByRole('button', { name: 'Close' }));
+ expect(screen.queryByText('Long form help content')).not.toBeInTheDocument();
+ });
+
+ it('applies a custom ariaLabel to the info button', () => {
+ render(
+ Help,
+ ariaLabel: 'Widget help details',
+ },
+ },
+ },
+ })}
+ />
+ );
+
+ expect(screen.getByRole('button', { name: 'Widget help details' })).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'More information' })).not.toBeInTheDocument();
+ });
+});
diff --git a/packages/module/src/WidgetLayout/types.ts b/packages/module/src/WidgetLayout/types.ts
index b0bb410..150938b 100644
--- a/packages/module/src/WidgetLayout/types.ts
+++ b/packages/module/src/WidgetLayout/types.ts
@@ -47,12 +47,24 @@ export interface WidgetHeaderLink {
href?: string;
}
+export interface WidgetInfo {
+ /** Body content shown in the popover or modal */
+ content: React.ReactNode;
+ /** Optional header/title for the popover or modal */
+ title?: React.ReactNode;
+ /** Defaults to 'popover'. Use 'modal' for longer content. */
+ variant?: 'popover' | 'modal';
+ /** Accessible label for the info icon button (default: "More information") */
+ ariaLabel?: string;
+}
+
export interface WidgetConfiguration {
icon?: React.ReactNode;
headerLink?: WidgetHeaderLink;
title?: string;
wrapperProps?: Omit;
cardBodyProps?: Omit;
+ info?: WidgetInfo;
}
/**
@@ -63,7 +75,7 @@ export interface WidgetDefinition {
widgetType: string;
/** Default dimensions for the widget */
defaults: WidgetDefaults;
- /** Widget configuration (title, icon, header link) */
+ /** Widget configuration (title, icon, header link, info) */
config?: WidgetConfiguration;
/** Function that renders the widget content */
renderWidget: (widgetId: string) => React.ReactNode;
From 861527aac432c5b0331eb17f61259d4661d8c9e4 Mon Sep 17 00:00:00 2001
From: Kim Doberstein
Date: Wed, 11 Nov 2026 14:27:49 -0600
Subject: [PATCH 2/2] fix: align widget header actions
---
packages/module/src/WidgetLayout/GridTile.tsx | 9 +++++----
packages/module/src/styles.css | 16 ++++++++++++++++
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/packages/module/src/WidgetLayout/GridTile.tsx b/packages/module/src/WidgetLayout/GridTile.tsx
index 46ce43d..a570550 100644
--- a/packages/module/src/WidgetLayout/GridTile.tsx
+++ b/packages/module/src/WidgetLayout/GridTile.tsx
@@ -211,7 +211,10 @@ const GridTile = ({
{dropdownItems}
{widgetConfig.static ? 'Widget locked' : 'Move'}}>
- }
onMouseDown={() => {
setIsDragging(true);
analytics?.('widget-layout.widget-move', { widgetType });
@@ -220,9 +223,7 @@ const GridTile = ({
className={clsx('pf-v6-widget-drag-handle', {
'pf-v6-widget-drag-handle--dragging': isDragging,
})}
- >
-
-
+ />
>
);
diff --git a/packages/module/src/styles.css b/packages/module/src/styles.css
index 6d82307..8ef289c 100644
--- a/packages/module/src/styles.css
+++ b/packages/module/src/styles.css
@@ -57,6 +57,22 @@
cursor: grab;
}
+.pf-v6-widget-grid-tile .pf-v6-widget-grid-tile__info-button,
+.pf-v6-widget-grid-tile .pf-v6-widget-grid-tile__menu-toggle,
+.pf-v6-widget-grid-tile .pf-v6-widget-drag-handle {
+ inline-size: var(--pf-t--global--spacer--lg);
+ block-size: var(--pf-t--global--spacer--lg);
+ min-inline-size: var(--pf-t--global--spacer--lg);
+ min-block-size: var(--pf-t--global--spacer--lg);
+ padding: 0;
+ align-items: center;
+ line-height: 0;
+}
+
+.pf-v6-widget-grid-tile .pf-v6-c-card__actions {
+ --pf-v6-c-card__actions--Gap: var(--pf-t--global--spacer--gap--action-to-action--plain);
+}
+
.pf-v6-widget-grid-tile .pf-v6-widget-drag-handle.pf-v6-widget-drag-handle--dragging {
cursor: grabbing;
}