Checkboxes with Streamlit

Learn to use the checkbox with Streamlit.

We'll cover the following


On its own, the checkbox widget isn’t useful.

However, when used with other code, a checkbox can be used as a toggle.

Execute the example

The code below demonstrates the checkbox widget:

In the first instance of the checkbox widget, a check mark appears in it when we click it. However, nothing happens beyond that.

The code that follows the first instance sets up the application to display a bar graph of the data if a user selects the checkbox.

This time, clicking on the checkbox toggles the visibility of the graph, as we see below:

Get hands-on with 1200+ tech skills courses.