Using this Component
Segmented controllers are used to select between multiple content views of a page section. This functions is similar to tabs, but with a more limited scope of content change.
Care should be taken that segmented controllers are used in places where it is contextually clear what content will be changed using the component. Often, a segmented controller should appear beneath a UISectionHeader to provide greater context and scope to the view selection being made by the user.
For a view controller that impacts more than one section of a page, consider using UITabsView.
Each segment of a segmented controller has a text label which should be kept as concise as possible. Text is centered within each segment.
Each segment of a segmented controller can have an optional icon placed to the left of the text label. Icons should either be uniformly present or uniformly absent in each segment. In select circumstances, an icon can fully replace the text label, though this is not recommended.
3. Selection Highlight
The selected segment takes on a background highlight, in addition to changing the label text style.
All segments of a segmented controller are displayed within one contiguous rectangular container. This indicates the clickable bounds of the element.
Segmented controllers should contain no more than 4 segments. The width of the component can be either fixed or responsive, but avoid making a segmented controller more than twice as wide as its labels.
Segmented controllers are directly interactive elements that show the user what view is currently presented, and reflect this state using label and highlight styling.
One segment must be selected at all times. Clicking anywhere on an unselected segment will change the view to that option. Clicking on the already selected segment has no impact.
When navigating to a page, the leftmost segment is selected by default.
Width & Alignment
The segmented controller container is equally divided between its segments. This remains true for responsive-width segmented controllers when width is changed due to browser scaling.
When a segment becomes too narrow to display the full label text, the label is truncated with an ellipsis (“…”).
Segment Order & Number
The number and order of segments is determined during implementation. Segments are not extensible or rearrangeable by users.
Component code details for this component are not currently available, but we're working on it!
Checkout this UIKit component's code and comments in the codebase for usage examples, props, and more.