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

Add Toolbar.MenuItem or similar? #612

Closed
targos opened this issue Dec 15, 2023 · 2 comments · Fixed by #635
Closed

Add Toolbar.MenuItem or similar? #612

targos opened this issue Dec 15, 2023 · 2 comments · Fixed by #635
Assignees

Comments

@targos
Copy link
Member

targos commented Dec 15, 2023

See use case in NMRium: https://github.com/cheminfo/nmrium/blob/6618ec1f26eec0a2c22bda4a17aae6e5f218c0cc/src/component/toolbar/BasicToolBar.tsx#L231-L247

@stropitek
Copy link
Contributor

Suggested API:
Add the Toolbar.PopoverItem component which wraps a Toolbar.Item in a blueprintjs Popover

Used in a toolbar it would look something like this:

<Toolbar>
  <Toolbar.Item />
  <Toolbar.PopoverItem
    itemProps={{
      /* can pass props to configure the toolbar item */
    }}
    /* Can pass any popover props except children */
    content={
      /* Use blueprintjs components here to do the menu */
      <Menu><MenuItem/></Menu>
    }
  />
  <Toolbar.Item />
</Toolbar>

The placement of the menu items with respect to the toolbar should have a sensible default depending if the toolbar is horizontal or vertical (use a context to know about the type of toolbar in the children).

@targos can you review the API proposal?

@targos
Copy link
Member Author

targos commented Jan 10, 2024

sgtm

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 a pull request may close this issue.

3 participants