Search⌘ K
AI Features

Checkbox with Gradio

Explore how to use Checkbox components in Gradio to create interactive boolean inputs for your applications. Understand the key parameters, event listeners, and event data attributes available. Learn through practical examples including toggling data visibility, which will help you build dynamic user interfaces in your machine learning projects.

Checkbox

A common UI element is a Checkbox, allowing the user to toggle between True or False. To instantiate a Checkbox, we type: gr.Checkbox().

A Checkbox can only take on a boolean value (True or False). If it is passed as an input into a function, it will pass the status of the Checkbox as a boolean. As an output, it expects a boolean returned from the function, and if True will check the checkbox.

Checkbox in Gradio
Checkbox in Gradio

The Checkbox supports some parameters, including (but not limited to):

  • value: Boolean, either True or False.

  • label: Optional label for the ...