Online tableau training, tableau tips, & video tutorials
How to Add a Show/Hide Button to a Tableau Layout ContainerPreview
Unlock Better User Experiences by Toggling Elements On and Off
Tableau’s Show/Hide button allows you to turn off access to filters when they’re not in use, do better sheet swapping, and much more. In this video, Ryan shows you how to use a Show/Hide button to create a toggle switch in Tableau.
Hi, this is Ryan with Playfair Data TV. In this video, I’m going to show you how to add a Show/Hide button to a Tableau layout container. The Show/Hide button is a feature that came along with Tableau version 2019.2 And it’s one of my favorite dashboard tactics, because it allows you to hide certain user experience elements while they’re not in use. It allows you to kind of keep a minimalist dashboard style, but still provide the flexibility for your user to click on a button and have those user experience elements open up and be accessible to them.
This has lots of implications. At a basic level and what most people probably think of first, is you have the ability to hide a row or a column of filters. You can toggle those filters on and off by clicking this button. But it allows us to do some other fun things as well. On another video, I show you how to use a Show/Hide button to do a new and improved way to do sheet swapping. And it’s a lot easier to implement than the traditional way. And in this video, I’m going to show you a sneaky way to create a Boolean toggle switch using a Show/Hide button.
So for this illustration, we’re going to be focused on this dashboard I call Where’s Ryan? That keeps track of my speaking engagements in the year 2020, as well as compares them to my past speaking engagements. What you’re seeing on the view right now is its default state that looks at all the speaking engagements in the year 2020. But if you click on this toggle switch, you’ll see all of my past events show up as blue circles.
There is a more advanced way to implement a Boolean toggle switch like this, but to start with, I’m going to show you how easy this can be using this Show/Hide button functionality. So I’m going to turn this off, and I’m actually going to recreate this user experience. So I’m going to delete that button for now.
To add a Show/Hide button, there’s a couple of requirements. First of all, you have to have a layout container. It’s technically the layout container that’s getting turned on and off with the button. Also, that layout container must be floating in order for this trick to work.
So what I’m going to do first is change my dashboard objects to floating and drag a either horizontal or vertical layer container onto the view. In this particular use case that I’m showing you, the container only has one thing. So it’s technically neither in a horizontal orientation or vertical orientation. So it doesn’t really matter. I can choose either one of these.
I’ll just drag the first one, Horizontal, onto the view. And before the video, I copied down the exact dimensions and location of that layout container. So bear with me while I change that a little bit, which you can do by going to the Layout pane and modifying the x-coordinate and the y-coordinate, as well as its width and height.
So now I just know that that layout container is floating exactly where I want. I had one number off here. I thought that looked a little bit short. There we go. So that blue box is showing me that there is a layout container on the view. Now I’m going to put something inside of that container.
As you can see, I have two sheets being shown right now. I’ve got the 2020 Map, which is what you can see currently. And then I’ve got what I call an All-Time Map. It’s the same exact visualization, except for the 2020 Map, I’ve got a filter on the year 2020. On my All-Time Map, that filter is not there.
This might be a little bit easier to see if I change the background back to black so you can see the silhouette of that map. But I made that transparent, which by the way, is another relatively new feature in Tableau. I made the background transparent by changing the filling to none. And that way, when I float this over the top, I have the nice custom background with a gradient going on there in the back. That’s why I did that.
But now I’m ready to add this All-Time Map into my layout container. So I need to go find that All-Time Map. Here it is. I’m just going to drag this All-Time Map into the container. Because my objects are still floating, I need to hold the Shift key while I get close to that container, and that shading is showing me where it’s going to drop that sheet.
When I let go, we’ve now got the All-Time Map inside of that container. Because there was a color legend, it added another vertical layer container to the right, along with my color legend. I want to actually get rid of that, which should return my sizing back to how I’d expect it.
Also, things aren’t quite lining up. You kind of see some weird borders around this. It’s very subtle. But by default, Tableau is bringing the sheet title along with the sheet. That’s pushing the map down about 20 to 25 pixels, and causing things to not align. I will hide that title by right-clicking on it and clicking Hide Title. And now we should be pretty closely lined up.
All right. Now for the Show/Hide button, how to add this. First you need to make sure that you select the entire container. Right now, that gray border is telling me that I’ve selected one individual sheet. To select the entire container, I need to double-click this gray rectangle at the top of the sheet.
If the border turns blue, that tells me that I have in fact selected the entire container. With the entire container selected, if I click this down arrow, one of the new options, relatively new options as of version 2019.2, is to add a Show/Hide button. I’ll click on that.
And by default, you will see an X appear when the sheet or when the container is visible, implying that if you click on that X, it will close the container. And that X gets converted into what’s called a hamburger menu. That’s the slang term for it. It’s a menu with three lines on it.
But those images are customizable. That’s what’s so nice about this, and leads to so many flexible user experiences. Now that I have added that Show/Hide button, if I click this down arrow again, and click Edit Button, I can make some changes in this interface.
And this is fairly intuitive. The logic takes a little bit of time to get used to, but it is fairly intuitive. You can customize what images show up when the container is being shown, as well as when it is being hidden. So let’s think about this. If my container is on, that means that the past events and the current events are being shown.
So when it’s being shown, I want the toggle to look like it is on. So I will choose an image that looks like the image is on. Click OK. Now I can toggle over to Item Hidden, and choose how it looks when the container is off. When it’s off, the past events are not being shown, and I want to show what looks like an off toggle to imply that if you click on that, it will show the past events and flip over to my On image.
Click OK. Click OK to close this. Well, before I do that, there are a couple of other options. I’m customizing the images, but you could also change that to just text. And you could do things like show an orange button with text on it if it’s open, and then when it’s closed, it could be a black button with text on it. So it’s a little more simple. You don’t need to create custom images.
You can also enter tooltips. This is the information that appears when you hover over the button. So I might add something like Click Here To Toggle On The Events. But for now, I’ll call this good and click OK.
And we do see, the images show up. I’ll make this a little bit bigger. By the way, these Show/Hide buttons act just like any other floating object when they’re added to a view. So I can change– I can go to the Layout pane, and I can change its exact height and width. I can change its exact location on the x and y-axes.
And this is just a new floating object. So one of the nice things about that is it doesn’t necessarily have to be immediately next to the layout container. I can make it more integrated with the rest of the dashboard and create a more customizable user experience.
In my case, I put the button up here in the top-right corner. Again, I’m going all the way down to the pixel here, you can take your time to format that as precisely as you would like. Because the container is currently being shown, I’m seeing the container with the past events on top of it, and I’ve got the On button in place.
You can go to Presentation mode to turn that off. So if I click that, that hides the container and my button flipped back to being the Off image. By the way, I’ll share one more little shortcut on this video. In the past, I’d always go to Presentation mode to test out some of these user experiences.
But you can also just hold the Control key. Sorry, the Alt key. Does the same thing. So if I hold the Alt key, I can test out this UX to make sure it’s working.
So in this video, we covered how to add a Show/Hide button to a layout container. You can essentially have a single button with customizable images or customized text that toggles on entire containers at a time. The use case that I used in this video is to show you kind of a tricky way, a really simple way to add a Boolean toggle switch in Tableau.
This has been Ryan with Playfair Data TV – thanks for watching!
Related video: How to do Sheet Swapping with Tableau Layout Containers
Related video: Making Your First Tableau Dashboard (Part 1)
Related video: How to Add a Button to a Tableau Dashboard
Related blog post: The Easiest Way to Make a Toggle in Tableau
Related chapter: Innovative Tableau – Chapter 6 – Show/Hide Button on Layout Containers
- Making Your First Tableau Dashboard (Part 1)
- Making Your First Tableau Dashboard (Part 2)
- An Introduction to Tableau Dashboard Actions
- How to Avoid Highlighting Dashboard Action Selections
- How to Use Tableau Parameter Dashboard Actions
- How to Do Pagination in Tableau
- Tableau Dashboard Element: The Current Versus Comparison Callout
- How to Make a Stock Ticker Gauge in Tableau
- How to Create Performance Indicator Titles in Tableau
- Tableau Dashboard Element: The Global Filters Tab
- Tableau Dashboard Element: The Parameterized Scatter Plot
- 3 Ways to Add a Button to a Tableau Dashboard
- How to Make a Navigation Bar with Buttons in Tableau
- How to Add a Filter in Use Alert to a Tableau Dashboard
- How to Highlight a Dimension Member in Tableau
- Exercise: Highlight a Dimension Member Using a Parameter Control
- How to Make Indicators with Custom Shape Palettes in Tableau
- How to Add a Show/Hide Button to a Tableau Layout Container