Tesserae

Option

Description

The Option component represents a single mutually exclusive choice inside a ChoiceGroup. In the public API, the helper method is Choice(...), and the underlying type is ChoiceGroup.Choice.

Use it when you need radio-button style selection where exactly one option should be active within a group.

Usage

Create options with Choice(...) and place them inside ChoiceGroup(...). The group manages shared selection state and exposes the selected option as an observable value.

API reference

class

ChoiceGroup

public sealed class ChoiceGroup : ComponentBase<ChoiceGroup, HTMLDivElement>, IContainer<ChoiceGroup, ChoiceGroup.Choice>, IObservableComponent<ChoiceGroup.Choice>

A group of radio-style choices of which exactly one may be selected at a time.

Constructors

Constructor
ChoiceGroup
public ChoiceGroup(string label = "Pick one")

Initializes a new instance of this class.

Properties

Property
ChoiceGroup.SelectedOption
public Choice SelectedOption { get ; private set ; }

Gets or sets the selected option.

Property
ChoiceGroup.Label
public string Label { get ; set ; }

Gets or sets the label shown by the component.

Property
ChoiceGroup.Orientation
public ChoiceGroupOrientation Orientation { get ; set ; }

Gets or sets the orientation.

Property
ChoiceGroup.IsRequired
public bool IsRequired { get ; set ; }

Gets or sets a value indicating whether the component is required for form submission.

Methods

Method
ChoiceGroup.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Method
ChoiceGroup.Add
public void Add(Choice component)

Adds the given item to the component.

Method
ChoiceGroup.Clear
public void Clear()

Clears the component's current state.

Method
ChoiceGroup.Replace
public void Replace(Choice newComponent, Choice oldComponent)

Replaces an existing item with a new one.

Method
ChoiceGroup.Choices
public ChoiceGroup Choices(params ChoiceGroup.Choice[] children)

Configures the component to choices.

Method
ChoiceGroup.Horizontal
public ChoiceGroup Horizontal()

Configures the component to horizontal.

Method
ChoiceGroup.Vertical
public ChoiceGroup Vertical()

Configures the component to vertical.

Method
ChoiceGroup.Required
public ChoiceGroup Required()

Marks the component as required.

Method
ChoiceGroup.AsObservable
public IObservable<Choice> AsObservable()

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

See also

Referenced by

© 2026 Tesserae. All rights reserved.