Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why are popover-related props passed to store and store provider#4295

Answeredbydiegohaz
ciampo asked this question inQuestions
Discussion options

Motivation

As I was reviewing theMenu API surface, I noticed that popover-related props (such asplacement,open, ...) need to be passed to the store / store provider component, while all other popover-related props (modal,gutter, ...) are passed directly to theMenu component. The same is true for components with a similar structure, likeSelect.

I found this a bit counter-intuitive, especially given that the prop could be completely redundant in case the consumer of the component doesn't need a popover, and decides to render aMenuList (orSelectList) instead of aMenu (or aSelectPopover).

Usage example

N/A

Requirements

Is there a reason for this API design choice? Should we consider moving popover-related props to the components rendering the popover ?

Workaround

No response

Possible implementations

No response

You must be logged in to vote

In earlier versions, all those props were passed to the store. We changed this inv0.2.0.

The plan was to moveplacement too, but it wasn't technically feasible since other components rely on this state.

Regardingopen, you can control this state by passing props to components (seeAriakit Popover with open prop passed to component). However, this state ultimately belongs to the store, so internally, we'll sync this prop with the store state.

Replies: 1 comment 3 replies

Comment options

In earlier versions, all those props were passed to the store. We changed this inv0.2.0.

The plan was to moveplacement too, but it wasn't technically feasible since other components rely on this state.

Regardingopen, you can control this state by passing props to components (seeAriakit Popover with open prop passed to component). However, this state ultimately belongs to the store, so internally, we'll sync this prop with the store state.

You must be logged in to vote
3 replies
@ciampo
Comment options

Got it, thank you for the context!

this state ultimately belongs to the store, so internally, we'll sync this prop with the store state.

Do you think this could be possible forplacement too?

@diegohaz
Comment options

This might be possible, but I haven't tried it.

@ciampo
Comment options

Regarding open, you can control this state by passing props to components (seeAriakit Popover with open prop passed to component). However, this state ultimately belongs to the store, so internally, we'll sync this prop with the store state.

Just wanted to also flag that only theopen prop is exposed, and that there are no equivalent props for thedefaultOpen and thesetOpen props, which means that it's still not really possible to pass those props to the menu popover component instead of the store/provider.

Answer selected bydiegohaz
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
2 participants
@ciampo@diegohaz
Converted from issue

This discussion was converted from issue #4294 on December 02, 2024 16:44.


[8]ページ先頭

©2009-2025 Movatter.jp