Skip to content

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

@vercel
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