Tabris.js Widgets: RadioButton

The widget represents an easy way to create a radio button. It helps you in situations when a user should pick only one of the multiple options. Once a radio button is selected, all other RadioButton elements under the same parent element will be un-selected automatically. This behavior is similar to HTML input type=”radio” tag.

RadioButton class structure is pretty straightforward due to the simple nature of the radio buttons. You can customize the radio dot itself using checkedTintColor and tintColor properties and the label text appearance by setting text, font, and textColor values. RadioButton positioning and size can be controlled using properties, inherited from the Widget parent class.

Take a look at the set of RadioButtons packed inside a simple Stack in JavaScript syntax.

And here is the same example but in JSX syntax. Both approaches look clean on such simple example, but it is recommended to use JSX markup instead of JS since it provides better code structure even for complex applications.

To explore all the widget class properties and events, use the RadioButton documentation page.