IconToggle

Description

A group of icon buttons of which exactly one is selected at a time, like a segmented control. Each item carries a UIcons glyph, a tooltip and an arbitrary data payload, which is exposed through the typed Selected property.

Usage

API reference

class

IconToggle<T>

public class IconToggle<T> : IComponent, IBindableComponent<T>, IRoundedStyle

A group of icon buttons of which exactly one is selected at a time, like a segmented control.

Namespace
Tesserae
Implements
IComponent, IBindableComponent<T>, IRoundedStyle

Constructors

NameDescription
IconToggleInitializes a new instance of this class.
Constructor
IconToggle
public IconToggle(Item[] items)

Initializes a new instance of this class.

Properties

NameDescription
SelectedGets the currently selected data.
Property
IconToggle.Selected
public T Selected

Gets the currently selected data.

Methods

NameDescription
RenderRenders the component's root HTML element.
SelectSelects the item carrying the given data. Values that don't match any item are ignored.
AsObservableReturns the component's state as a(n) observable.
SetBoundValueProgrammatically selects an item as part of a two-way binding. Values that don't match any item are ignored.
OnChangeCalls the handler whenever the selection changes, but not for the initial selection.
CompactRenders a denser control, for toolbars and other tight spots.
LargeRenders a roomier control, for use as a primary, page-level switch.
VerticalStacks the items top to bottom instead of left to right.
HorizontalStacks the items left to right, the default.
FullWidthStretches the control to the width of its container, with every item taking an equal share.
DisabledConfigures whether the whole control is disabled.
Method
IconToggle.Render
public HTMLElement Render()

Renders the component's root HTML element.

Method
IconToggle.Select
public IconToggle<T> Select(T item)

Selects the item carrying the given data. Values that don't match any item are ignored.

Method
IconToggle.AsObservable
public IObservable<T> AsObservable()

Returns the component's state as a(n) observable.

Method
IconToggle.SetBoundValue
public void SetBoundValue(T value)

Programmatically selects an item as part of a two-way binding. Values that don't match any item are ignored.

Method
IconToggle.OnChange
public IconToggle<T> OnChange(Action<IconToggle<T>, T> onChange)

Calls the handler whenever the selection changes, but not for the initial selection.

Method
IconToggle.Compact
public IconToggle<T> Compact()

Renders a denser control, for toolbars and other tight spots.

Method
IconToggle.Large
public IconToggle<T> Large()

Renders a roomier control, for use as a primary, page-level switch.

Method
IconToggle.Vertical
public IconToggle<T> Vertical()

Stacks the items top to bottom instead of left to right.

Method
IconToggle.Horizontal
public IconToggle<T> Horizontal()

Stacks the items left to right, the default.

Method
IconToggle.FullWidth
public IconToggle<T> FullWidth()

Stretches the control to the width of its container, with every item taking an equal share.

Method
IconToggle.Disabled
public IconToggle<T> Disabled(bool value = true)

Configures whether the whole control is disabled.

See also

© 2026 Curiosity. All rights reserved.