RadioButton
ic.RadioButton is a single-select radio group that lets the user pick one option from a list. Each option is rendered as a labeled radio circle. The selected value always corresponds to one of the Items strings, and unlike list selectors, there is no empty state — the group always has a selection.
Variants
Variant controls the fill color of the selected radio circle. Use primary for standard selections, secondary for lower visual weight, and destructive when the choice has dangerous or irreversible consequences. Unselected circles look the same across all variants.
Size, label and orientation
Size scales the radio circles and label text together. Label adds an optional group heading above the options. LabelPosition places each row label to the left or right of its circle, and Orientation switches between a vertical stack and a horizontal row.
Icons
You can attach an ic.Icon to individual items using the setIcon method. Icons appear next to the label text and help distinguish options visually when labels alone are not enough.
Events
RadioButton fires a ValueChanged event each time the user selects a different option. The payload carries the label string of the newly selected item. In MATLAB, attach a listener with addlistener and read the value from evt.Data.value.
Custom styling
Every component exposes a .css property that lets you inject instance-level CSS directly from MATLAB. Here the radio circles are squared off with a green accent color. The selectors target .ic-radio__circle and its selected modifier.
rb = ic.RadioButton( ...
"Items", ["A", "B", "C"], ...
"Variant", "primary", ...
"Size", "lg");
rb.css.style(".ic-radio__circle", ...
"border_radius", "3px", ...
"width", "18px", ...
"height", "18px");
rb.css.style(".ic-radio__circle--selected.ic-radio__circle--primary", ...
"background_color", "#10b981", ...
"box_shadow", "0 2px 8px rgba(16, 185, 129, 0.4)");linear-gradient, backdrop-filter, or newer color functions may not work everywhere. For reference, MATLAB R2024b uses Chromium 104.
Always test your custom styles in the MATLAB version you are targeting, and use canIuse to check compatibility of specific CSS features if you know the browser version MATLAB is using.
Use the Developer Tools component to inspect the DOM structure of each component and find the right selectors for styling.