Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Popover]: remove min-width on Popover.Content #600

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kevinmitch14
Copy link

Description

Removed min-width CSS on Popover.Content. This was causing 2 issues as far as I can tell.

  1. When the Popover.Trigger is wide, the content of the Popover will stretch to the same width of the trigger (--radix-popover-trigger-width)
  2. Even when explicitly stating <Popover.Content maxWidth="120px"/>, the Content will stretch to the same size as the Trigger.
Screenshot 2024-10-03 at 12 26 36

Copy link

vercel bot commented Oct 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
themes-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 11:41am

@chaance
Copy link
Member

chaance commented Oct 4, 2024

I think having a min-width of the trigger size is a good default for most cases. I think it might be better to have a separate custom property for the min-width set to the trigger width by default, but users can more easily override it directly this way.

-  min-width: var(--radix-popover-trigger-width);
+  --radix-popover-min-width: var(--radix-popover-trigger-width);
+  min-width: var(--radix-popover-min-width);

Thoughts?

@kevinmitch14
Copy link
Author

Hmm, this still runs into the issue where if you define maxWidth={"200px"} and the trigger is 300px wide, the Popover.Content will be 300px 🤔

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