Skip to content

feat(scraps): Add Tooltip.Header, Body, Row and Footer - #121983

Draft
ChrisandraVaz wants to merge 2 commits into
masterfrom
cv/scraps/tooltip-compound
Draft

feat(scraps): Add Tooltip.Header, Body, Row and Footer#121983
ChrisandraVaz wants to merge 2 commits into
masterfrom
cv/scraps/tooltip-compound

Conversation

@ChrisandraVaz

@ChrisandraVaz ChrisandraVaz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Splitting #121854 into three PRs based on the review feedback. This is the first one, and it only adds the tooltip primitives so the RelativeTime card has something to build on.

Right now TooltipContent hardcodes padding: md lg and text-align: center. That's fine for a sentence but wrong for a card, so anything card shaped has to cancel both by hand. We already do that in three places: logsTimeTooltip, breadcrumbsTimeline, and group.tsx. RelativeTime was about to be the fourth.

  • padding defaults to today's md lg, so nothing existing changes. Set it to "0" when you're composing sections.
  • Tooltip.Header / Footer take a label plus an optional trailing value. Sentence case, no bottom border.
  • Tooltip.Body owns the grid the rows line up against.
  • Tooltip.Row renders as display: contents so its cells become items of the body's grid. That's what keeps columns aligned across rows when one cell is wider than the one above it.

Also forwards padding through InfoText, since that's the path TimeSince takes to get to the tooltip. Primitives only here, nothing migrated yet.

<Tooltip
  padding="0"
  title={
    <Fragment>
      <Tooltip.Header trailing="8mo ago">Last Seen</Tooltip.Header>
      <Tooltip.Body columns="max-content 1fr max-content">
        <Tooltip.Row>
          <Tag variant="info">PDT</Tag>
          <Text>Jul 28, 2026</Text>
          <Text align="right">11:40 PM</Text>
        </Tooltip.Row>
      </Tooltip.Body>
    </Fragment>
  }
>
  {trigger}
</Tooltip>

Stack

Bottom of a 3 PR stack:

  1. this PR, the tooltip sections
  2. up next, moving the timezone provider into scraps for Dominik's isolation point
  3. and last, RelativeTime + TimeSince (feat(scraps): Add RelativeTime component #121854) rebased on both

1 and 2 don't touch each other so they can go in parallel. 3 needs both of them.

Test plan

  • tooltip.spec.tsx covers the padding default, the opt out, the sections, and row alignment. Green.
  • pnpm typecheck, lint:js, and 783 tests across 72 core suites. Green.
  • Story: tooltip.mdx.

Open questions

  • Bottom border. I dropped it since size and weight already separate the header, but the RelativeTime design does have a separator there, so worth a second opinion.
  • All caps. The new header is sentence case, but EVENTS in group.tsx is still uppercase. Migrating that is what would actually standardize things. Happy to do it here or in PR 3.
  • Tooltip.Footer has no consumer yet. The "Add your local timezone" link in logsTimeTooltip looks like a likely first one, but I can drop it until something needs it.
  • Header and Footer are nearly identical, they only differ on bold vs variant="muted". I left them separate because the design system guidance says two adjacent copies aren't worth abstracting, but say the word if you'd rather have one.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 13, 2026
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Story previews

Preview the stories changed in this PR on the Vercel deployment:

Preview deployment: https://sentry-3mt5o1sus.sentry.dev

Tooltip content that is a row of labelled values rather than a sentence
currently has to fight the overlay: it hardcodes `padding: md lg` and
`text-align: center`, so a card wanting full-width sections has to cancel
both with negative margins. That pattern is already hand-rolled twice, in
logsTimeTooltip and breadcrumbsTimeline, and RelativeTime was about to be
the third.

Adds a `padding` prop (defaulting to the current `md lg`, so no existing
tooltip changes) and four sections that own their own spacing.
`Tooltip.Body` owns the grid and `Tooltip.Row` renders as
`display: contents`, so a column stays aligned across rows even when one
row's cell is wider than the same cell above it.

Also forwards `padding` through InfoText, which is the path TimeSince
takes to the tooltip.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant