feat(components): Add Placement Prop to Menu#3024
Open
Conversation
ZakaryH
commented
Mar 30, 2026
| ReactNode, | ||
| } from "react"; | ||
| import type { Pressable as AriaPressable } from "react-aria-components"; | ||
| import type { Placement } from "@react-types/overlays"; |
Contributor
Author
There was a problem hiding this comment.
this is the only thing I'm a little unsure about. this is using RAC's Placement and values
on Popover we offer
readonly preferredPlacement?: "top" | "bottom" | "left" | "right" | "auto";
but this will be
so we're not being consistent, but the granularity is so much greater. it's perfectly reasonable to want to be bottom start or bottom end. bottom alone can't capture that.
so there's a small decision to make here around what naming convention we wanna use. hyphenated is another one I've seen e.g bottom-end
Contributor
Author
There was a problem hiding this comment.
we can come up with our own Placement type to re-use across the project when dealing with this sort of prop.
Deploying atlantis with
|
| Latest commit: |
aa8c5f4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b119c5b5.atlantis.pages.dev |
| Branch Preview URL: | https://menu-position-prop-please.atlantis.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivations
Menu uses a "floating" popup to show the items, since we have a Trigger that we anchor to - it's reasonable to want to decide which side it should go on, when it can.
note that the "flipping" behavior when we can't do what the preferred placement wants is already enabled by the default on
AriaPopoverwe will default to "bottom start" to avoid being too great of a change, and that's a reasonable default imo.
Changes
Added
new prop
preferredPlacement(matchesPopover) onMenu.Contentto set the preferred position of the Menu popup.Changed
Deprecated
Removed
Fixed
Security
Testing
try using the new prop on a composable Menu, it should respect the value when it can. note that this behavior comes entirely from RAC, so there's not much for us to test.
Changes can be
tested via Pre-release
In Atlantis we use Github's built in pull request reviews.