Group Box
Overview
Display blocks are the top-level visual containers for the content in your views. Most views work well with the single level of containership and organization that display blocks provide.
But some views are complex enough to warrant yet another level of organization of the data within their display blocks. Group boxes offer this secondary level of containership and organization, within display blocks. Each group box has a title, with its content displayed below that.
Group boxes are used to further organize content within a display block. You can place group boxes as top-level children within the display block or you can nest group boxes within a tab component. But you should not place group boxes anywhere outside of a display block, in dialog boxes, in toolbars, or anywhere else other than inside a display block.
You can present multiple group boxes within the same display block. You can lay out multiple group boxes in a display block using either responsive layout or fixed layout.
Unlike display blocks, you must always set a title for each group box.
If you have buttons or other elements that apply only to the data within one specific group box, you can optionally include a toolbar within that group box. Group box toolbars display below the group box title.
Group boxes can operate in one of three different modes: simple, expandable, and accordion. Each of these modes is discussed below.
Simple group boxes
Simple group boxes display a header, with their content below that.
Expandable group boxes
Expandable group boxes display a header and content just like simple group boxes, but they also allow the user to dynamically hide and show the content by clicking on the group box header. Clicking the header toggles between the expanded and collapsed states. The header displays an icon that indicates the expanded/collapsed state. Expandable group boxes can be initially displayed in either the expanded or collapsed state.
Accordion group boxes
Accordion group boxes are a collection of expandable group boxes where no more than one group box is open at a time. All accordion group boxes in the collection can be collapsed, but only one group box in the collection can be expanded at a time. Expanding an accordion group box will automatically collapse all other accordion group boxes in the collection.
A view can include more than one collection of accordion group boxes if needed. Your app defines which accordion group boxes are part of which collection. If you include multiple collections of accordion group boxes, they should typically appear in different display blocks to help the user better understand the groupings.
Fixed layout for group boxes
If you’re using fixed layout for group boxes, you must use simple group boxes in order to get the proper layout. Expandable and accordion group boxes are not supported in fixed layout.
Development
Web component development
Component reference
rui-group-box
Group boxes are an optional secondary level of visual containers for the content within display blocks. Each display block may include one or more group boxes.
Name | Type | Default | Description |
---|---|---|---|
titleText | string | '' | Title displayed in the group box header. This is required. |
subtitleText | string | '' | Optional subtitle displayed at the top-right of the group box. You should not use a subtitle without a title. |
isExpandable | boolean | false | Set this to true if the user should be able to collapse and expand the group box content. This includes accordion group boxes. Leave this at its default value of false if you don’t need expand/collapse behavior or if you’re using fixed layout for this group box. |
isExpanded | boolean | false | Specifies whether an expandable group box is initially expanded. This value is updated internally when the user expands or collapses the group box, independent of the initial value set by your application. If you need to track the group box’s expanded/collapsed state in your code, then handle the rui-is-expanded-change event to store the updated value passed in the event detail into the backing boolean value in your controller. |
containsError | boolean | false | Set this to true if this group box contains one or more inputs that are in an error state. The group box displays error styling when this property is true. |
accordionGroup | string | '' | If this is an accordion group box, assign the same value for this property to all group boxes in the same accordion collection. The actual value you use doesn’t matter, it just has to be the same for all group boxes in the same accordion collection. |
accordionId | string | '' | If this is an accordion group box, assign a unique value for this property to all group boxes in the same accordion collection. The actual value you use doesn’t matter, it just has to be unique within all group boxes in the same accordion collection. |
isBusy | boolean | false | Displays a busy indicator within the group box when set to true. Set this to true if the data within the group box is currently being loaded, false otherwise. The busy indicator does not display for expandable group boxes that are collapsed. |
busyText | string | '' | Text displayed below the spinning busy indicator when isBusy is true. |
rui-is-expanded-change | event | Event fired when the isExpanded property value changes. The new property value is passed as the event detail. | |
isFullHeight | boolean | false | By default, group boxes are auto height, meaning they take their height from their content. Set isFullHeight to a value of true when you need the group box to take 100% of its parent’s height, such as in fixed layout. |
Implementation
Begin by importing the rui-layout
module into your application.
Implementing simple group boxes
Use the rui-group-box
tag to create a group box. Nest the group box content within the opening and closing rui-group-box
tags.
Implementing expandable group boxes
If the user should be able to collapse and expand the group box content, set the isExpandable
property to true. You can optionally have an expandable group box display initially expanded by setting the isExpanded
property to true.
If you need to track the group box’s expanded/collapsed state in your code, then handle the rui-is-expanded-change
event to store the updated value passed in the event detail into the backing boolean value in your controller.
Implementing accordion group boxes
To create a collection of accordion group boxes, where no more than one group box in the collection can be expanded at a time, set the isExpandable
property to true for each group box, assign the same value to the accordionGroup
property for each group box in the collection, and assign a unique value to the accordionId
property for each group box in the collection. You can optionally have one of the group boxes in the collection be initially expanded by setting its isExpanded
property to true.
Implementing fixed layout for group boxes
See the fixed layout development doc for info on how to set up fixed layout for group boxes.
Angular wrapper development
Wrapper reference
jha-group-box
Group boxes are an optional secondary level of visual containers for the content within display blocks. Each display block may include one or more group boxes.
Name | Type | Default | Description |
---|---|---|---|
jhaTitle | string | '' | Title displayed in the group box header. This is required. |
jhaSubtitle | string | '' | Optional subtitle displayed at the top-right of the group box. You should not use a subtitle without a title. |
jhaIsExpandable | boolean | false | Set this to true if the user should be able to collapse and expand the group box content. This includes accordion group boxes. Leave this at its default value of false if you don’t need expand/collapse behavior or if you’re using fixed layout for this group box. |
jhaIsExpanded | boolean | false | Specifies whether an expandable group box is initially expanded. This value is updated automatically when the user expands or collapses the group box. If you need to track the group box’s expanded/collapsed state in code, then use two-way binding to bind this to a boolean value in your TypeScript. If you don’t need to track the expanded/collapsed state, then simply provide a true or false value. |
jhaContainsError | boolean | false | Set this to true if this group box contains one or more inputs that are in an error state. The group box displays error styling when this property is true. |
jhaAccordionGroup | string | '' | If this is an accordion group box, assign the same value for this property to all group boxes in the same accordion collection. The actual value you use doesn’t matter, it just has to be the same for all group boxes in the same accordion collection. |
jhaAccordionId | string | '' | If this is an accordion group box, assign a unique value for this property to all group boxes in the same accordion collection. The actual value you use doesn’t matter, it just has to be unique within all group boxes in the same accordion collection. |
jhaIsBusy | boolean | false | Displays a busy indicator within the group box when set to true. Set this to true if the data within the group box is currently being loaded, false otherwise. The busy indicator does not display for expandable group boxes that are collapsed. |
jhaBusyText | string | '' | Text displayed below the spinning busy indicator when jhaIsBusy is true. |
jhaIsExpandedChange | event | Event fired when the jhaIsExpanded property value changes. Use this event if you need to update anything in your TypeScript whenever this value changes. |
Implementation
Begin by importing JhaLayoutModule
and BrowserAnimationsModule
into your application.
Implementing simple group boxes
Use the jha-group-box
tag to create a group box. Nest the group box content within the opening and closing jha-group-box
tags.
Implementing expandable group boxes
If the user should be able to collapse and expand the group box content, set the jhaIsExpandable
property to true. You can optionally have an expandable group box display initially expanded by setting the jhaIsExpanded
property to true.
If you need to track the group box’s expanded/collapsed state in code, then use two-way binding on the jhaIsExpanded property to bind this to a boolean value in your TypeScript. There is also a jhaIsExpandedChange event for the rare case where you need to update anything else in your TypeScript whenever the jhaIsExpanded value changes (not shown here).
Implementing accordion group boxes
To create a collection of accordion group boxes, where no more than one group box in the collection can be expanded at a time, set the jhaIsExpandable
property to true for each group box, assign the same value to the jhaAccordionGroup
property for each group box in the collection, and assign a unique value to the jhaAccordionId
property for each group box in the collection. You can optionally have one of the group boxes in the collection be initially expanded by setting its jhaIsExpanded
property to true.
Implementing fixed layout for group boxes
See the fixed layout development doc for info on how to set up fixed layout for group boxes.
Component playground
Design
Figma design
Dev Component | Design Component Name |
---|---|
Group box - fixed | RUI / Layout / Group Box Available values for the Layout property:
Turn on the Contains Error property to show the group box when it contains a validation error. |
Group box subtitle | Add text, then apply rui/regular as the Text Style and rui-pacific/content-subtitle as the Color Style. |
After adding a group box to your design, resize it and change the title in its header to an appropriate value.
Adobe XD design
- Sample App - Group Box
- Sample App - Content Layout
Dev Component | Design Component Name |
---|---|
Group box - fixed | JHA / Layout / Group Box / Fixed |
Group box - expanded | JHA / Layout / Group Box / Expanded |
Group box - collapsed | JHA / Layout / Group Box / Collapsed |
Group box subtitle | Add text and apply the “JHA / Text / Display Block Subtitle” character style. |
It can be helpful to lock the group box component while you drag other components onto it.
After adding a group box to your design, resize it and change the title in its header to an appropriate value.