uitogglebutton
Create toggle button in a button group.
📝Syntax
h = uitogglebutton()
h = uitogglebutton(parent)
h = uitogglebutton(..., propertyName, propertyValue)
📥Input Arguments
Parameter Description
parent parent container.
propertyName, propertyValue name-value pairs.
📤Output Arguments
Parameter Description
h UI component object.
📄Description

tb = uitogglebutton(bg) creates a toggle button inside a uibuttongroup with exclusive selection. Properties: Value, Text, Icon, IconAlignment, alignments, BackgroundColor, fonts.

💡Examples
Captured UI component for the help image.
f = uifigure('Visible', 'off', 'Name', 'Toggle buttons', 'Position', [100 100 420 260]);
bg = uibuttongroup(f, 'Position', [95 60 230 140]);
tb1 = uitogglebutton(bg, 'Text', 'A', 'Position', [30 70 70 30]);
tb2 = uitogglebutton(bg, 'Text', 'B', 'Position', [125 70 70 30]);
tb2.Value = true;
drawnow();
Example illustration
uitogglebutton
f = uifigure();
bg = uibuttongroup(f);
tb1 = uitogglebutton(bg, 'Text', 'A');
tb2 = uitogglebutton(bg, 'Text', 'B');
🔗See Also
uifigure
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub