Skip to content

feat(ui): add Tooltip primitive to @infrahub/ui#9496

Open
pa-lem wants to merge 1 commit into
developfrom
ple-ui-tooltip
Open

feat(ui): add Tooltip primitive to @infrahub/ui#9496
pa-lem wants to merge 1 commit into
developfrom
ple-ui-tooltip

Conversation

@pa-lem

@pa-lem pa-lem commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What

Adds a Tooltip primitive to the @infrahub/ui design system — a port of the app's existing react-aria tooltip (shared/components/aria/tooltip), converted to the design system's tailwind-variants convention.

Tooltip is one of the shared/components/ui primitives slated for migration into @infrahub/ui per dev/knowledge/frontend/design-system.md.

Scope

  • New Tooltip component + Storybook story; exported from the barrel and as a ./tooltip subpath.
  • No call-site migration — the 39 existing app usages keep the current shared tooltip (identical-looking) until the broader migration. This PR only adds the primitive.

Why now

It's the base dependency for a follow-up @infrahub/graph package (graph-view primitives) whose GraphControls needs a tooltip that isn't coupled to the app. Splitting it out keeps that change reviewable on its own.

🤖 Generated with Claude Code


Summary by cubic

Adds a Tooltip primitive to @infrahub/ui, ported from the app’s tooltip to use tailwind-variants. No call-site changes; this unblocks @infrahub/graph’s GraphControls.

  • New Features
    • Tooltip wraps a trigger child and shows a message on hover/focus, built on react-aria-components.
    • Exported from the index and via @infrahub/ui/tooltip.
    • Storybook story added under Components/Tooltip.

Written for commit 25ad2e9. Summary will update on new commits.

Review in cubic

Ports the react-aria Tooltip into @infrahub/ui (tailwind-variants), one of the
shared/components/ui primitives slated for migration per dev/knowledge/frontend/design-system.md.
@pa-lem pa-lem requested a review from a team as a code owner June 8, 2026 13:06
@github-actions github-actions Bot added the group/frontend Issue related to the frontend (React) label Jun 8, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files

Confidence score: 3/5

  • There is some merge risk because a medium-severity, high-confidence issue in frontend/packages/ui/src/components/tooltip/tooltip.tsx can cause composed className styles to be overwritten, which may drop tooltip variant/animation behavior in the UI.
  • A second issue in frontend/packages/ui/src/components/tooltip/tooltip.tsx uses a falsy check for message, so valid ReactNode values like 0 won’t render a tooltip; this is user-facing but lower severity.
  • Pay close attention to frontend/packages/ui/src/components/tooltip/tooltip.tsx - prop spread/className merge order and message conditional rendering can both affect visible tooltip behavior.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="frontend/packages/ui/src/components/tooltip/tooltip.tsx">

<violation number="1" location="frontend/packages/ui/src/components/tooltip/tooltip.tsx:31">
P2: Using a falsy check on `message` hides valid ReactNode values (e.g. `0`) and skips rendering the tooltip.</violation>

<violation number="2" location="frontend/packages/ui/src/components/tooltip/tooltip.tsx:47">
P2: `className` composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.</violation>
</file>

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic


/** Accessible tooltip. Wraps a trigger child and shows `message` on hover/focus. */
export function Tooltip({ children, message, isOpen, onOpenChange, ...props }: TooltipProps) {
if (!message) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Using a falsy check on message hides valid ReactNode values (e.g. 0) and skips rendering the tooltip.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/packages/ui/src/components/tooltip/tooltip.tsx, line 31:

<comment>Using a falsy check on `message` hides valid ReactNode values (e.g. `0`) and skips rendering the tooltip.</comment>

<file context>
@@ -0,0 +1,66 @@
+
+/** Accessible tooltip. Wraps a trigger child and shows `message` on hover/focus. */
+export function Tooltip({ children, message, isOpen, onOpenChange, ...props }: TooltipProps) {
+  if (!message) {
+    return children;
+  }
</file context>
Suggested change
if (!message) {
if (message === null || message === undefined || message === "") {

Comment on lines +47 to +50
className={composeRenderProps(props.className, (className, renderProps) =>
tooltipStyles({ ...renderProps, className }),
)}
{...props}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: className composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/packages/ui/src/components/tooltip/tooltip.tsx, line 47:

<comment>`className` composition is overridden by the later props spread, so tooltip variant/animation styles can be dropped.</comment>

<file context>
@@ -0,0 +1,66 @@
+
+      <AriaTooltip
+        offset={10}
+        className={composeRenderProps(props.className, (className, renderProps) =>
+          tooltipStyles({ ...renderProps, className }),
+        )}
</file context>
Suggested change
className={composeRenderProps(props.className, (className, renderProps) =>
tooltipStyles({ ...renderProps, className }),
)}
{...props}
{...props}
className={composeRenderProps(props.className, (className, renderProps) =>
tooltipStyles({ ...renderProps, className }),
)}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/frontend Issue related to the frontend (React)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant