Skip to content

Conversation

@stephl3
Copy link
Collaborator

@stephl3 stephl3 commented Nov 19, 2025

✍️ Proposed changes

Adds a new variant prop to the Tooltip component with two options: 'default' and 'compact'. The 'compact' variant provides a smaller, more space-efficient tooltip design with reduced padding and border radius. This change also implements a discriminated union type system that prevents the baseFontSize prop from being used when variant is set to 'compact', ensuring type safety and preventing invalid prop combinations.

🎟️ Jira ticket: LG-5713

✅ Checklist

  • I have added stories/tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have run pnpm changeset and documented my changes

🧪 How to test changes

  1. Default variant (existing behavior):

    • Render a Tooltip without specifying variant or with variant="default"
    • Verify it displays with the standard padding and border radius
    • Verify baseFontSize prop works correctly
  2. Compact variant:

    • Render a Tooltip with variant="compact"
    • Verify it displays with reduced padding and smaller border radius
    • Verify the notch is not rendered for compact variant
    • Attempt to use baseFontSize prop with variant="compact" and verify TypeScript prevents this combination
  3. Type safety:

    • In a TypeScript file, attempt to pass both variant="compact" and baseFontSize props together
    • Verify TypeScript shows a type error preventing this invalid combination
  4. Visual regression:

    • Check Storybook stories for both variants in light and dark modes
    • Verify the compact variant maintains proper contrast and readability

@stephl3 stephl3 requested a review from a team as a code owner November 19, 2025 00:08
@stephl3 stephl3 requested review from adamrasheed, Copilot and tsck and removed request for a team and Copilot November 19, 2025 00:08
@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

🦋 Changeset detected

Latest commit: 1df05bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
@leafygreen-ui/tooltip Minor
@leafygreen-ui/code-editor Patch
@leafygreen-ui/code Patch
@leafygreen-ui/copyable Patch
@leafygreen-ui/guide-cue Patch
@leafygreen-ui/info-sprinkle Patch
@leafygreen-ui/inline-definition Patch
@leafygreen-ui/number-input Patch
@leafygreen-ui/pipeline Patch
@leafygreen-ui/side-nav Patch
@leafygreen-ui/stepper Patch
@leafygreen-ui/toolbar Patch
@lg-chat/lg-markdown Patch
@leafygreen-ui/drawer Patch
@leafygreen-ui/chip Patch
@lg-chat/message Patch
@leafygreen-ui/combobox Patch
@lg-chat/message-feed Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

2 participants