Sub topic 4
Adding and formatting buttons
This chapter covers how to insert a button, what each formatting group controls, and how to size and name buttons so later chapters can wire them to bookmarks and navigation. It assumes you can add visuals and slicers to a page, use the Selection pane, and create a basic bookmark.
What a button is
A button is a visual that responds to a click. By itself it only has a look. It does nothing until you give it an action, such as applying a bookmark or going to another page. The next chapter covers actions. Here you build the shell: its type, appearance, size, and accessibility properties.
Buttons use the same formatting model as other visuals. You select the button, open the Format pane, and change settings. They are visuals, so they appear in the Selection pane, have a layer order, can be grouped, and can be copied between pages.
Inserting a button
On the Home or Insert tab, open the Buttons menu and pick a type. The wording varies a little between Desktop versions, but the choices are consistent.
| Type | What you get | Typical use |
|---|---|---|
| Blank | An empty rectangle with no text or icon | Custom buttons where you set every property |
| Left arrow, Right arrow | A button with an arrow icon | Paging or stepping through views |
| Back | An arrow icon, plus a Back action preconfigured | Return from a drill-through page or overlay |
| Reset | A reset icon, with a bookmark action to be assigned | Reset patterns |
| Information, Help, Q&A | A symbol icon | Opening help overlays, or the Q&A experience |
| Bookmark | A button with the Bookmark action type selected | Applying a saved bookmark |
| Navigator (page or bookmark) | A single visual that generates a button for each page or bookmark | Menus, covered in a later chapter |
The preset types differ mostly in their starting icon and starting action. You can change either afterward, so a Blank button with an icon and a Bookmark action behaves the same as a Bookmark preset. Pick the preset closest to what you want and adjust it.
A new button appears on the active page, selected and ready to format. Resize it by dragging the handles, or set exact values under General > Properties in the Format pane.
Formatting a button
Select the button and open Format visual. The groups you will use most are shown in the diagram.
Style: shape, text, and icon
The Style group has separate cards for shape, text, and icon, and each has its own on/off toggle.
- Shape sets the outline form. Rectangle, rounded rectangle, and other shapes are available. With a rounded rectangle you can set the corner radius. Shape also affects the area that responds to clicks, so a circle is not clickable in its corners.
- Text turns on a label and lets you set font, size, color, alignment, and padding. The text box has an fx option for conditional formatting, which later chapters use for dynamic labels.
- Icon turns on a symbol. You choose from the built-in icons, then set its color, line weight, size, and position. Icons come from a fixed set, and the icon-only and text-only layouts are the most reliable. When you turn on both text and icon, adjust padding so they do not overlap.
Fill, border, shadow, and glow
These settings control the button's body.
- Fill sets the background color and transparency. With a fill at 100% transparency, the button is invisible but typically still catches clicks. Report authors use this to lay a clickable area over another visual or an image.
- Border sets color, width, and corner radius for the outline.
- Shadow and Glow add depth. Use them sparingly. One effect on the primary action is usually enough.
Size, padding, and layout
Set Properties for exact width and height, and align buttons using the Format tab's Align and Distribute commands. Consistent sizes matter more than any single style choice. A row of buttons with the same height, spacing, and font looks like a toolbar. Mixed sizes look accidental.
Text that does not fit wraps or clips. If a label is cut off, enlarge the button, shorten the text, or reduce padding before reducing the font size.
Button states
A Style card has an Apply settings to dropdown that lists the states: default, on hover, on press, and disabled. Each state can have its own fill, border, text color, and icon color. The next chapter treats states in full. For this chapter, make all your formatting changes with the dropdown set to Default. Otherwise, you may style the hover state and wonder why the idle button looks unchanged.
Accessibility properties
Two settings give a button meaning to people who cannot see it.
- Alt text is read by screen readers. An icon-only button needs it, because otherwise nothing describes the button. Write what the action does, for example "Open filter panel", not what the button looks like.
- Tooltip appears when a mouse hovers. It helps sighted users who cannot tell what an icon means.
You also control the keyboard order. In the Selection pane you can set the tab order, and a screen reader or keyboard user moves through buttons in that sequence. Put the buttons in the order a person would expect to use them.
Naming and organizing buttons
By default, buttons appear in the Selection pane as "Button", "Button (2)", and so on. With a dozen buttons on a page, you cannot tell which is which. Rename each one by double-clicking its name in the Selection pane. Use names that say what the button does, such as btn_OpenFilters, btn_CloseFilters, btn_Reset. A prefix like btn_ makes buttons easy to scan next to slicers and charts.
Two organizing habits pay off later:
- Group a button with the shapes or images that sit under it, so one name hides or shows the whole control.
- Keep buttons that must appear on every page identical in size and position. Copy and paste the button onto each page instead of rebuilding it, which preserves its position.
Testing a button in Desktop
In Power BI Desktop, a button does not run its action on a plain click, because a click selects it for editing. Hold Ctrl and click to trigger the action. In the Power BI service, and in Desktop's reading view, a plain click works. You can tell the difference by the pointer: a hand cursor appears over a button when Ctrl is held.
Common errors
- The format changes do not appear. The state dropdown is set to hover, press, or disabled, not default.
- Text is clipped. The button is too small for the label or padding is too large.
- A button works for you but is missing for others. It is hidden in the Selection pane, or a bookmark that hides it was applied. Check visibility there.
- Clicking does nothing in Desktop. You did not hold Ctrl.
- A click lands on the wrong object. Another visual or transparent button sits above it. Check the layer order in the Selection pane.
- The icon-only button is unlabeled for a screen reader. Alt text is empty.
Exercise
You added a Blank button, turned on its text, and set the fill to dark blue, but the button looks the same when you hover the pointer over it in reading view. You also notice the Apply settings to dropdown shows "On hover". What is the likely cause, and how do you fix it?
Show answer
The fill change was applied to the hover state, not to the default state, so the idle button was never restyled. Set the dropdown to Default and apply the fill there. Keep the hover color under On hover if you still want a different color while the pointer is over the button.
Exercise
A report has an icon-only button that opens a filter panel. Name two properties you should set so people who cannot see the icon, or who are unsure what it means, can use it.
Show answer
Set the alt text, for example "Open filter panel", so a screen reader announces the button's purpose. Set the tooltip so sighted users see a label on hover. Also give the button a clear name in the Selection pane and check its tab order.