Skip to content

Add secondary value slot to OverviewCard - #2416

Open
ravikiranvm wants to merge 2 commits into
mainfrom
overview-card-secondary-value
Open

Add secondary value slot to OverviewCard#2416
ravikiranvm wants to merge 2 commits into
mainfrom
overview-card-secondary-value

Conversation

@ravikiranvm

@ravikiranvm ravikiranvm commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Part of OPS-4666

Extends the OverviewCard component API to support supplementary content next to the main value.

Additional Notes

Two additive, backward-compatible changes:

  • value is widened from string | number to ReactNode, so consumers can pass richer values (e.g. a tooltip-wrapped element) where needed. Plain strings and numbers render exactly as before.
  • New optional secondaryValue?: ReactNode prop, rendered baseline-aligned to the right of the value inside a wrapping flex row. When the prop is unused the card renders identically to today (single flex child at baseline — no visual change).

The immediate consumer is an upcoming dashboard KPI that shows compact secondary amounts beside the main value; the slot itself is generic. A WithSecondaryValue story documents the usage.

Widen the value prop to ReactNode and add an optional secondaryValue
rendered baseline-aligned to its right, so consumers can attach compact
supplementary content (e.g. secondary amounts) or tooltip-wrapped values
without changing the card's layout when the slot is unused.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 09:58
@linear

linear Bot commented Jul 30, 2026

Copy link
Copy Markdown

OPS-4666

Copilot AI 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.

Pull request overview

Extends the shared OverviewCard component in packages/ui-components to support richer value rendering and an optional secondaryValue slot for supplementary inline content, with a Storybook story documenting the new API.

Changes:

  • Widen value prop type to ReactNode and add optional secondaryValue?: ReactNode prop.
  • Render value + secondaryValue in a baseline-aligned flex row within the card.
  • Add a WithSecondaryValue Storybook story demonstrating the new slot.

Blocking

  • Rendering value: ReactNode inside a <p> can produce invalid HTML and layout breakage if consumers pass block elements; use a non-paragraph wrapper for the value styling instead.

Non-blocking

  • None

Merge recommendation

  • Do not merge

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/ui-components/src/components/overview-card/overview-card.tsx Extends the component API (value as ReactNode, adds secondaryValue) and updates layout to render both inline.
packages/ui-components/src/stories/overview-card/overview-card.stories.tsx Adds a Storybook example (WithSecondaryValue) to document the new slot usage.

Comment thread packages/ui-components/src/components/overview-card/overview-card.tsx Outdated
The value prop accepts any ReactNode, and a p element only permits
phrasing content — a block child would be invalid HTML.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@ravikiranvm
ravikiranvm requested a review from MarceloRGonc July 30, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants