Reveal Button
Reveal Buttons trigger actions users can take in an interface.
Also known as: collapse, disclosure, button, expand, reveal
Basic usage
Permalink to "Basic usage"The reveal button includes dynamic content that is updated based on its state. This state is toggled by user interaction.
This content may include text, icons, or a combination of both.
Dynamic text
Permalink to "Dynamic text"<bolt-reveal-button
label="Button"
labeltoggled="Button toggled"
></bolt-reveal-button>
<bolt-reveal-button
label="Print"
labeltoggled="Print toggled"
iconleft="print"
></bolt-reveal-button>
<bolt-reveal-button
label="Print"
labeltoggled="Print toggled"
iconright="print"
></bolt-reveal-button>
<bolt-reveal-button
label="Document"
labeltoggled="Document toggled"
iconright="download"
iconleft="document"
></bolt-reveal-button>
Dynamic icon
Permalink to "Dynamic icon"The left icon is always static, but the right icon can be static or dynamic.
To make iconright dynamic, provide an option for iconrighttoggled.
If the Reveal Button does not include text, or if its text is static, arialabel and arialabeltoggled MUST be included to provide accessibility information for the action being taken.
<bolt-reveal-button
label="Bookmark"
iconright="bookmark"
iconrighttoggled="bookmark-filled"
arialabel="Bookmark"
arialabeltoggled="Bookmark toggled"
></bolt-reveal-button>
<bolt-reveal-button
iconright="bookmark"
iconrighttoggled="bookmark-filled"
arialabel="Bookmark"
arialabeltoggled="Bookmark toggled"
></bolt-reveal-button>
<bolt-reveal-button
iconleft="document"
iconright="star"
iconrighttoggled="star-filled"
arialabel="Favorite"
arialabeltoggled="Favorite toggled"
></bolt-reveal-button>
Dynamic text and icon
Permalink to "Dynamic text and icon"When both text and icon are dynamic, an aria label is not required.
<bolt-reveal-button
label="Bookmark"
labeltoggled="Bookmark toggled"
iconright="bookmark"
iconrighttoggled="bookmark-filled"
></bolt-reveal-button>
Button configuration
Permalink to "Button configuration"Reveal Button supports the same variations as the basic Button component.
However, it allows a restricted set of options for type, color, and size.
Type
Permalink to "Type"Reveal Button may use outline (default) or ghost button types. Solid reveal buttons are not supported.
<bolt-reveal-button
type="outline"
label="Outline"
labeltoggled="Outline toggled"
></bolt-reveal-button>
<bolt-reveal-button
label="Ghost"
labeltoggled="Ghost toggled"
type="ghost"
></bolt-reveal-button>
Color
Permalink to "Color"Reveal button includes the same default and theme color options as Button. Static button colors options are not supported.
<div class="bolt-background-darkBlue">
<bolt-reveal-button
label="On dark blue"
labeltoggled="On dark blue toggled"
></bolt-reveal-button>
</div>
<bolt-reveal-button
label="Primary"
labeltoggled="Primary toggled"
color="primary"
></bolt-reveal-button>
<bolt-reveal-button
label="Secondary"
labeltoggled="Secondary toggled"
color="secondary"
></bolt-reveal-button>
<bolt-reveal-button
label="Tertiary"
labeltoggled="Tertiary toggled"
color="tertiary"
></bolt-reveal-button>
Size
Permalink to "Size"Reveal Button supports small and medium (default) button sizes. Large reveal buttons are not supported.
<bolt-reveal-button
label="Small"
labeltoggled="Small toggled"
size="sm"
></bolt-reveal-button>
<bolt-reveal-button
label="Medium (default) toggled"
labeltoggled="Medium toggled"
></bolt-reveal-button>
State
Permalink to "State"<bolt-reveal-button
label="Reveal"
labeltoggled="Reveal toggled"
type="outline"
disabled
></bolt-reveal-button>
<bolt-reveal-button
label="Ghost"
labeltoggled="Ghost toggled"
type="ghost"
disabled
></bolt-reveal-button>
Badge
Permalink to "Badge"For more information, see Button with Badge or standalone Badge documentation.
<bolt-reveal-button
label="Button"
labeltoggled="Button toggled"
badgecount="3"
></bolt-reveal-button>
Syntax
Permalink to "Syntax"<bolt-reveal-button
[arialabel="..."]
[arialabeltoggled="..."]
[arialabelledby="..."]
[badgecolor="..."]
[badgecount="..."]
[color="..."]
[datatestbutton="..."]
[disabled]
[iconleft="..."]
[iconright="..."]
[iconrighttoggled="..."]
[label="..."]
[labeltoggled="..."]
[size="..."]
[type="..."]
...
></bolt-reveal-button>
Properties
Permalink to "Properties"In addition to global HTML attributes, the <bolt-reveal-button> custom element supports the following properties.
State-related properties
Permalink to "State-related properties"toggled: (optional)- If present, applies the toggled state.
- If absent, this communicates that the element has not been acted upon by the user, or has been un-toggled from a previously toggled state.
There are 3 sets of attributes that may be used to provide dynamic content based on the reveal button's state.
- Default state
label: (optional) Provides the text content for the reveal button.arialabel: (optional) Sets thearia-labelattribute of the underlying<button>element.iconright: (optional) Icon to display on the right side of the button.- see [Iconography][iconography] for supported icons
- Toggled state
labeltoggled: (optional) Provides the text content for the reveal button in its toggled state.arialabeltoggled: (optional) Sets thearia-labelattribute of the underlying<button>element in its toggled state.iconrighttoggled: (optional) Icon to display on the right side of the button in its toggled state.
If labeltoggled is not present (such as with static text or icon-only), then arialabel and arialabeltoggled are required.
Additional properties
Permalink to "Additional properties"Additionally, the <bolt-reveal-button> element supports the following parameters:
arialabelledby: (optional) Sets thearia-labelledbyattribute of the underlying<button>element.badgecount: (optional) Configures the number count shown on the badge.- Values:
1 ≤ badgecount- A minimum value of
1is required for the badge to appear. - Values below
2are not shown on the badge.
- A minimum value of
- Values:
badgecolor: (optional) Sets the badge color.- Values:
darkerror(default)light
- Values:
color: (optional) By default, automatically adapts to contextual theme and global theme to ensure accessible contrast.When configuring button color, designers are responsible for meeting brand standards and contrast minimums. - Theme colors dynamically update with the global theme.
- Provides a consistent hierarchy of accent colors that work in both light and dark mode.
- Values:
primarysecondarytertiary
disabled: (optional) Boolean flag used to disable the button.iconleft: (optional) Icon to display on the left side of the button.- see [Iconography][iconography] for supported icons
size(optional) The size of the button.- See "Button size" design guidelines for more info.
- Values:
smmd(default)
type: (optional) Overrides the button style.- See "Button types" design guidelines for more info.
- Values:
ghostoutline(default)
Icon-only button
Permalink to "Icon-only button"<bolt-reveal-button
[iconleft="..."]
[iconright="..."]
[iconrighttoggled="..."]
[arialabel="..."]
[arialabeltoggled="..."]
...
></bolt-button>
- To configure the icon, you may use either
iconrightalone or together withiconleft. - Icon-only elements MUST include values for both
iconrightandiconrighttoggled. - You will need to make use of the
arialabelandarialabeltoggledproperties to configure an accessible label for each state of the reveal button.
Events
Permalink to "Events"bolt-reveal-button-toggle: fires on click when reveal button is in un-toggled statebolt-reveal-button-untoggle: fires on click when reveal button is in toggled state
Internals
Permalink to "Internals"Test selectors
Permalink to "Test selectors"[data-test="button"]- Targets the primary interactive element.
- Value is configurable via the
datatestbuttonproperty
General guidelines
Permalink to "General guidelines"- Reveal Buttons allow for the display of 2 paired actions within one element.
- Reveal Buttons trigger actions users can take in an interface, and should never be a Link.
- Reveal buttons often show/hide or expand/collapse other elements in an interface.
- Reveal Buttons have content that changes between each expanded and collapsed state. It may be the label text, right icon, or both depending on the variation.
- There may be instances with icon only Reveal Buttons where it is not desirable to have the Icon change, such as a “more actions” Dropdown that utilizes our “vdots” Icon. In this scenario the Icon may be static, however, the aria-label must be different between the expanded and collapsed states.
- Do not disable a Reveal Button if there's even a small chance users do not understand what to do to enable it. It is an industry best practice and Nationwide’s standard to allow a user to always be able to press a Button in an interface. This allows the user to receive messaging informing them what they can do to fix an issue rather than letting them struggle to figure out what they can do to enable the Button.
Reveal Button types
Permalink to "Reveal Button types"- The use of Outline and Ghost Button types help create a clear visual hierarchy from other elements on the page. This hierarchy guides users through the interface, ensuring they can quickly identify and complete tasks.
- There is no Solid option as Solid styling is reserved for the highest priority or most preferred action on the page. This should never be an action triggered by a Reveal Button since these Buttons represent 2 actions.
- When more than 3-4 Buttons are grouped together, lean towards the Ghost styling so the interface doesn’t become too cluttered.
| Type | Visual | Description |
|---|---|---|
| Outline (default) | Outline only, no fill
For actions that support the primary action, but less visually prominent, or for when there are multiple preferred actions a user can take. |
|
| Ghost | No outline, no fill
Used for optional actions that users can take – much less prominent to users. |
Using icons
Permalink to "Using icons"- Only use Icons that clearly communicate their meaning.
- When the right Icon in a Reveal Button is dynamic, pair the icons with outlined and filled variations of the same Icon (like pencil and pencil-filled), or use other sensical pairs (like caret-up and caret-down or moon and sun Icons for dark/light mode). If no obvious pair exists, the xmark Icon may be useful if the Button open/closes another element.
- Often, the right Icon in a Reveal Button will indicate opening/closing with carets or chevrons. They may indicate from which direction an associated element may appear once the Reveal Button is clicked. While this is possible, it is not necessary and it should not interfere with common text/Icon pairs (such as “Close” for the label being paired with an xmark Icon).
Icon-only and two-icons Reveal Buttons
Permalink to "Icon-only and two-icons Reveal Buttons"- Icon-only and two-icons Reveal Buttons should be reserved for:
- when the Icon is easily understood by an average user or has been widely standardized, such as the icons used for ‘more actions’ (vdots) or ‘settings’ (gear).
- when screen real estate is at a premium.
- Two-icons Reveal Buttons should only use carets or chevrons in the right Icon slot and is meant to indicate open/close and expand/collapse actions. The left Icon should be static.
Button size
Permalink to "Button size"- Choosing the right Button size depends on the context and the importance of the action.
| Size | Visual | Description |
|---|---|---|
| Medium (default) | Standard size, used in almost all instances. | |
| Small | Used for less critical actions or when space is limited. |
Button color
Permalink to "Button color"- The use of primary, secondary, and tertiary colors helps in creating a visual prominence to Reveal Button hierarchy.
| Color | Visual | Description | |
|---|---|---|---|
| Global theme aware | |||
| Primary |
|
|
Used for the most preferential or important actions. Uses a color that stands out against the background and other elements on the page. |
| Secondary |
|
|
Used for actions that are important but not as critical as primary actions. Uses a color that complements the primary color but does not compete with it for attention. |
| Tertiary |
|
|
Used for the least important actions, often optional or less frequently used. Uses a color that minimizes distraction. |
| Global theme & context aware | |||
| Auto (default) |
|
|
Automatically finds the highest contrast color. |
When to use
Permalink to "When to use"- When a button needs to represent up to 2 actions depending on if it is clicked or not.
- When a button triggers the appearance or disappearance of content or another screen element.
When to use something else
Permalink to "When to use something else"- When navigation to another page or site is desired; use Link.
- When text within a paragraph is used to navigate to another page, use a Link.
- Consider using Checkbox, Switch or segmented controls for toggleable states in which the visual appearance of the control changes, but the content and accessible label does not.
- When submitting data, like a form, use Button. When validating a selection, confirming a choice or agreeing to terms and conditions, use Checkbox.
Do
- Use concise, descriptive labels with clear, active verbs.
- Use established colors.
- Use Reveal Button to trigger the appearance/disappearance of elements like Dialog, side panels (drawers/sheets), or content.
- Mix Reveal Buttons and Buttons in groups when space is limited and different types of related actions can be taken by the user.
Don't
- Don't use long or redundant labels.
- Don't use colors outside of those documented.
- Don't mix different colors of Reveal Buttons (or Buttons) in the same group.
- Don't remove or override the default focus styles on a Button.
Content guidelines
Permalink to "Content guidelines"- Use sentence case for labels.
- Reveal Button labels should be as short as possible and include "trigger words" that clearly explain the singular action that will take place when the Button is clicked, such as "Open" or "Close."
- Consider leading with a strong, actionable verb.
- Don’t use vague terms like “button”, "Click Here", "more", "click for details.”
- Maintain consistency with terms and language.
Best Practices
Permalink to "Best Practices"- The
arialabelattribute will override ARIA attributes of child components.- If
arialabelis defined, ARIA attributes of children will have to manually added (e.g. badge).
- If
Disabled buttons
Permalink to "Disabled buttons"- When applying the
disabledattribute to<bolt-reveal-button>, the underlying<button>element is semantically disabled.- Disabled buttons are removed from the tab order, and cannot receive keyboard focus.
- Disabled buttons can still receive screen reader focus, and can be accessed by screen reader navigation controls such as the arrow keys.
All Bolt components have gone through accessibility testing, but please keep our accessibility guidelines in mind.