Making your own toggle buttons

I love fussing with UI design elements and have a restless curiosity about how I can use them in Tableau. Toggle buttons are my recent crush, I saw some pretty examples on Pinterest, and I wanted to recreate them. Maybe I watched more Linklater films over the weekend than I should’ve, so I’m sure there’s a better use case then what I created, but it was fun trying this out.

Final design in Illustrator

Wanna know how to make your own Toggle buttons using Illustrator? Here comes an easy tutorial for you! (By the way, the same can be done in Figma, I’m just more comfortable using AI.)

How to make your own toggle buttons?

At first, you have to draw a rectangle, that would be the slider of your button. You’ll see four circles appearing in the corner, and the only thing you have to do is grabbing one of them and start moving it inwards until the radius reaches the total (changes to red).

The next step is adding colors, there are several options to use gradients in Illustrator, for this one I used the default “Sky” option, that I tweaked a little. All four points can be modified, you can even add more by clicking on the scale, or remove them by dragging the point out of the pane. The original direction of the gradient goes from left to right, but you can change that by choosing a different angle (as in the picture) or by using the Gradient tool (as in the video).

Using gradients in Illustrator

What comes next is adding the shadows. A common mistake, that a lot of people add too dark shadows, while it’s best to operate with a more subtle one (color: #878787). Here’s what I use as a best practice:

My default drop shadow settings

To have the toggle button ready, I drew an ellipse and added the same drop shadow, plus made some design elements to emphasize that it’s my “day mode” button. To make it easier, I already had my gradient prepared and I just used the Eyedropper tool to catch those colors at the end. Here’s a video of the whole process:

Using them in Tableau was as easy as it seems. I grouped the elements of the button and exported them one by one as png, then added them to my Tableau Repository. I did the same with the “Sunrise”, “Sunset”, and “Midnight” buttons. I used set actions and animations to achieve this transition effect, if you want to do the same, check out this awesome tutorial by Andy Kriebel.

You can also have a look and explore my workbook on Tableau Public.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.