Toolbar
Overview
A toolbar is a horizontal container that contains buttons and other options that are scoped to the function, a display block, a group box, or a tab.
Toolbars display in 3 primary locations:
- Each function view can include an optional toolbar for the function. You can display this toolbar either below the function title or to the right of the function title.
- Each display block can also include an optional toolbar. You can display this toolbar either below the display block title or to the right of the display block title.
- Each group box can also include an optional toolbar. This toolbar displays below the group box title.
- Likewise, each tab can also include an optional toolbar. This toolbar displays below the tab header bar, above the selected tab content.
Toolbars help you scope buttons to the containers on which they act, If there are multiple display blocks in a view and a specific element operates only on data that is contained within one of those display blocks, you should place that element into a toolbar within that display block. Otherwise, you should put that element into a toolbar at the function level. Similarly, if an element operates only on data that is contained within a group box, you should put that element into a toolbar within that group box. By scoping these options within a toolbar at the appropriate container level, you help users understand what data that option operates on.
Each function view can also have a floating toolbar, which displays at the top of the function view after the user scrolls down some. The floating toolbar is separate from the function or display block toolbars. You can add any combination of elements from the function or display block toolbars to the floating toolbar.
You can optionally group related items in a toolbar by placing a toolbar separator between different groups of items. Toolbar separators should be used sparingly, and only where a strong relationship exists between all items separated into a group.
One common usage of toolbars is to include inputs that affect the data displayed below the toolbar. In many cases this works well, but in some cases the number and size of inputs is too large to fit within the space allocated to the toolbar. Here are a couple options that can help in this case:
- Consider replacing multiple related buttons with one dropdown button that includes each of those options in its dropdown menu. This is a great way to save space in your toolbars.
- Instead of displaying all of the inputs within the toolbar, consider moving most if not all of them into a modal dialog, with a button in the toolbar that displays that dialog. You should also display a summary of the current input values within the toolbar, so the user understands the data’s context.
- Instead of using a date input and
jha-date-picker-button
for prompting for date values, consider using thejha-date-button
instead. Thejha-date-button
component takes up less width than the input andjha-date-picker-button
, making it ideal for cases where space is at a premium, including toolbars.
Development
Web component development
Component reference
rui-toolbar
Contains toolbar elements.
Name | Type | Default | Description |
---|---|---|---|
slot | string | '' | The slot in which this toolbar displays. One of:
|
rui-floating-toolbar
Contains toolbar elements that display at the top of the content area after the user has scrolled a specified number of pixels down the page.
Name | Type | Default | Description |
---|---|---|---|
displayScrollPixels | number | 150 | Specifies the amount in pixels the user has to scroll down the view before the floating toolbar displays. Leave this at its default value for consistency across views, unless you absolutely need to override this for a particular view. Only values greater than zero are honored. |
rui-floating-toolbar-is-visible | event | Event fired when the floating toolbar visibility changes. The visible status of the toolbar is passed in the custom event’s detail. |
rui-toolbar-separator
Used to separate related groups of items within a toolbar.
Name | Type | Default | Description |
---|---|---|---|
context | string | 'content' | The context in which this toolbar separator is used in. One of:
|
Implementation
Begin by importing the rui-layout
module into your application.
Function Toolbar
The following example implements a function toolbar that displays below the function title:
The following example implements a function toolbar that displays to the right of the function title:
Floating Toolbar
The following example illustrates a floating toolbar:
Display Block Toolbar
The following example implements a display block toolbar that displays below the display block title:
The following example implements a display block toolbar that displays to the right of the display block title:
Group Box Toolbar
The following example implements a group box toolbar:
Tab Toolbar
The following example implements a tab toolbar:
Displaying Text in a Toolbar
To display standalone text in a function toolbar, add the text to a span that has the rui-function-toolbar-text
themed CSS class applied.
Angular wrapper development
Wrapper reference
jha-function-toolbar
Contains toolbar elements for the entire function. Displays below the function title.
jha-function-toolbar-right
Contains toolbar elements for the entire function. Displays to the right of the function title.
jha-floating-toolbar
Contains toolbar elements that display at the top of the content area after the user has scrolled down the page.
Name | Type | Default | Description |
---|---|---|---|
jhaDisplayScrollPixels | number | 150 | Specifies the amount in pixels the user has to scroll down the view before the floating toolbar displays. Leave this at its default value for consistency across views, unless you absolutely need to override this for a particular view. Only values greater than zero are honored. |
jhaFloatingToolbarIsVisible | event | Event fired when the floating toolbar visibility changes. The event returns either true or false noting the visible state of the toolbar. |
jha-display-block-toolbar
Contains toolbar elements for a display block. Displays below the display block title.
jha-display-block-toolbar-right
Contains toolbar elements for a display block. Displays to the right of the display block title.
jha-group-box-toolbar
Contains toolbar elements for a group box. Displays below the group box title.
jha-tab-toolbar
Contains toolbar elements for a tab. Displays below the tab header bar, above the selected tabs content.
jha-toolbar-separator
Used to separate related groups of items within a toolbar.
Implementation
Begin by importing the JhaLayoutModule
module into your application.
Function Toolbar
The following example implements a function toolbar that displays below the function title:
The following example implements a function toolbar that displays to the right of the function title:
Floating Toolbar
The following example illustrates a floating toolbar:
Display Block Toolbar
The following example implements a display block toolbar that displays below the display block title:
The following example implements a display block toolbar that displays to the right of the display block title:
Group Box Toolbar
The following example implements a group box toolbar:
Tab Toolbar
The following example implements a tab toolbar:
Displaying Text in a Toolbar
To display standalone text in a function toolbar, add the text to a span that has the jha-function-toolbar-text
themed CSS class applied.
Component playground
Design
Figma design
Dev Component | Design Component Name |
---|---|
Floating toolbar | RUI / Layout / Floating Toolbar |
Toolbar separator | RUI / Layout / Toolbar Separator Available values for the Context property:
|
Text in function toolbar | Add text, then apply rui/toolbar as the Text Style and rui-pacific/function-title as the Color Style. |
Text in display block toolbar or content toolbar | Add text, then apply rui/toolbar as the Text Style and rui-pacific/content-subtitle as the Color Style. |
The function toolbar, display block toolbar, and content toolbar (used for group boxes, tabs, and other container components) are all invisible, so there are no design components for those toolbars. To design these toolbars, simply group the toolbar elements within in a single horizontal strip and vertically center them.
The floating toolbar is visible, so there is a design component for it.
All items within toolbars should be vertically centered and separated by 6 pixels of space. It can be very helpful to turn on auto layout for the group containing the toolbar elements.
You can use the toolbar separator design component to visually group related sets of toolbar elements if needed.
If you need to display text in a toolbar, see the appropriate entries in the table above.
Adobe XD design
- Sample App – Toolbars
- Sample App - Toolbars – Floating Toolbar
Dev Component | Design Component Name |
---|---|
Floating toolbar | JHA / Layout / Floating Toolbar |
Function toolbar separator | JHA / Layout / Function Toolbar Separator |
Display block toolbar separator | JHA / Layout / Display Block Toolbar Separator |
Content toolbar separator | JHA / Layout / Content Toolbar Separator |
Text in function toolbar | Add text and apply the “JHA / Text / Function Toolbar” character style. |
Text in display block toolbar or content toolbar | Add text and apply the “JHA / Text / Regular” character style. |
The function toolbar, display block toolbar, and content toolbar (used for group boxes, tabs, and other container components) are all invisible, so there are no design components for those toolbars. To design these toolbars, simply group the toolbar elements within in a single horizontal strip and vertically center them.
The floating toolbar is visible, so there is a design component for it.
All items within toolbars should be vertically centered and separated by 6 pixels of space. It can be very helpful to turn on horizontal stacking for the group containing the toolbar elements.
You can use the toolbar separator design component to visually group related sets of toolbar elements if needed.
If you need to display text in a toolbar, see the appropriate entries in the table above.