Skip to content

RadioButton

Steve Hannah edited this page Jul 8, 2021 · 1 revision

RadioButton

<radioButton>javadoc

Synopsis

RadioButton is a Button that maintains a selection state exclusively within a specific ButtonGroup. Check out CheckBox for a looser selection approach. Both components support a toggle button mode using the toggle="true" attribute.

Tip
Check out RadioButtonList if you want to create a group of radio buttons that toggle between each other. Check out RADButtonList if you want the selection of the button group to be bound to a view property.

Example

<?xml version="1.0"?>
<y xsi:noNamespaceSchemaLocation="RadioButtonSample.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <title>Radio Button Sample</title>
    <label>Select One:</label>

    <!-- Add some radio buttons.
        Note: We use rad-var to make them available inside the script tag
        to add them to the same button group -->
    <radioButton text="blue" rad-var="blueRadio"/>
    <radioButton text="yellow" rad-var="yellowRadio"/>
    <radioButton text="orange" rad-var="orangeRadio"/>
    <script>
        /* Add buttons to a ButtonGroup so only one can
            be selected at a time.
         */
        new ButtonGroup(blueRadio, yellowRadio, orangeRadio);
    </script>


    <spanLabel>Select One (Toggle version):</spanLabel>
    <radioButton text="blue" rad-var="blueToggle" toggle="true"/>
    <radioButton text="yellow" rad-var="yellowToggle" toggle="true"/>
    <radioButton text="orange" rad-var="orangeToggle" toggle="true"/>
    <script>
        /* Add buttons to a ButtonGroup so only one can
            be selected at a time.
         */
        new ButtonGroup(blueToggle, yellowToggle, orangeToggle);
    </script>

</y>
RadioButtons
Clone this wiki locally