kibana/packages/shared-ux/button_toolbar
Hannah Mudge bb9bbf4086
[Dashboard] [Canvas] Replace deprecated SolutionToolbar with Shared UX Toolbar (#151381)
Closes https://github.com/elastic/kibana/issues/147263

## Summary

This PR fixes the styling of the Dashboard and Canvas toolbars by
migrating from the Presentation Util `SolutionToolbar` over to the
Shared UX `Toolbar` component:

- **Dashboard:**

![ToolbarBeforeAfter](https://user-images.githubusercontent.com/8698078/220703481-66429e79-fc85-43c2-9197-56f4aee12343.png)
- **Canvas:**

![CanvasToolbarBeforeAfter](https://user-images.githubusercontent.com/8698078/220707385-47ad3c81-ffea-4ecc-8423-84656a99ce21.png)




However, in order to keep the styling the same, this also required
editing the Shared UX `Toolbar` (and its related components) in order to
support non-primary buttons. When initially migrating, **only** primary
buttons were supported for the `Toolbar` component - this resulted in a
Dashboard toolbar that looked like this, which goes against the EUI
guideline of only having a single primary button:

<p align="center">
<img width="500px"
src="https://user-images.githubusercontent.com/8698078/220704118-fc8515b7-dbb6-43ce-99a7-1db2f41c915a.png"/>
</p>

I did this by removing the old `PrimaryButton` component and replacing
it with the more generic `ToolbarButton` - as part of this, I migrated
both the `ToolbarPopover` and the `AddFromLibrary` buttons to use this
new component. I updated the related Storybooks to reflect the
capabilities I added to each component, such as making the
`ToolbarPopover` **conditionally** take the `iconType` prop and, if not
given, it will default to an `arrowDown` icon on the right side of the
button:


![Feb-22-2023
10-30-48](https://user-images.githubusercontent.com/8698078/220708646-b42533db-21e9-49f5-b48e-21d759a2f085.gif)

Since only Dashboard and Canvas used the Presentation Util
`SolutionToolbar`, now that these have been migrated, I removed all the
old deprecated components from Presentation Util as a final clean up.


### Checklist

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [x] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
- Checked on Chrome, Firefox, and Safari to ensure that all styles were
applied



### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2023-02-24 11:03:36 -07:00
..
src [Dashboard] [Canvas] Replace deprecated SolutionToolbar with Shared UX Toolbar (#151381) 2023-02-24 11:03:36 -07:00
index.ts [Dashboard] [Canvas] Replace deprecated SolutionToolbar with Shared UX Toolbar (#151381) 2023-02-24 11:03:36 -07:00
jest.config.js [Shared UX] Move Solution Toolbar components to package (#134392) 2022-06-21 02:00:57 -05:00
kibana.jsonc [codeowners] rename global experience to @elastic/appex-sharedux 2023-01-18 10:02:49 -07:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.mdx [Shared-UX] Migrate Toolbar component from presentation to shared-ux (#137224) 2022-08-29 13:22:38 -07:00
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

---
id: sharedUX/Components/Toolbar
slug: /shared-ux/components/button_toolbar
title: Toolbar
summary: An implementation of the popover, primary button, icon button group and add from library button
tags: ['shared-ux', 'component', 'toolbar']
date: 2022-07-28
---

This `toolbar` component accepts a `children` prop. Children can include a `popover` or a generic `button`. It can also include the `IconButtonGroup` and `AddFromLibrary` component for soltuions. 
Styling of the popover and button follow the primary styles.


```jsx
   <Toolbar>
      {{
        primaryButton,
        iconButtonGroup,
        extraButtons,
        addFromLibraryButton,
      }}
    </Toolbar>
```