The segmented-control
component represents a group of
radio
elements within a fieldset element, styled to look
like segments.
Used to present a range of radio options that are styled to look like series of buttons.
<label>
must be present for each
<radio>
item.<label>
must be explicitly associated
with the <radio>
using matching for
and id
attribute values<fieldset>
and <legend>
must be present to provide an overall label for the group of
options.Used for a left-aligned, non-stretched segemented control.
<fieldset class="segmented-control">
<legend>legend</legend>
<ul class="segmented-control__list">
<li>
<input type="radio" id="example1-option1" name="example1">
<label for="example1-option1">one</label>
</li>
<li>
<input type="radio" id="example1-option2" name="example1">
<label for="example1-option2">two</label>
</li>
</ul>
</fieldset>
Used for a left-aligned, stretched segemented control.
<fieldset class="segmented-control segmented-control--stretched">
<legend>Legend</legend>
<ul class="segmented-control__list">
<li>
<input type="radio" id="example2-option1" name="example2">
<label for="example2-option1">one</label>
</li>
<li>
<input type="radio" id="example2-option2" name="example2">
<label for="example2-option2">two</label>
</li>
<li>
<input type="radio" id="example2-option3" name="example2">
<label for="example2-option3">three</label>
</li>
</ul>
</fieldset>
Used for a centered, non-stretched segemented control.
<fieldset class="segmented-control segmented-control--centered">
<legend>Legend</legend>
<ul class="segmented-control__list">
<li>
<input type="radio" id="example3-option1" name="example3">
<label for="example3-option1">one</label>
</li>
<li>
<input type="radio" id="example3-option2" name="example3">
<label for="example3-option2">two</label>
</li>
<li>
<input type="radio" id="example3-option3" name="example3">
<label for="example3-option3">three</label>
</li>
</ul>
</fieldset>