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.

Namespace
Tesserae
Inheritance
ComponentBase<ChoiceGroup, HTMLDivElement> → ChoiceGroup
Implements
IContainer<ChoiceGroup, ChoiceGroup.Choice>, IObservableComponent<ChoiceGroup.Choice>

Constructors

NameDescription
ChoiceGroupInitializes a new instance of this class.
Constructor
ChoiceGroup
public ChoiceGroup(string label = "Pick one")

Initializes a new instance of this class.

Properties

NameDescription
SelectedOptionGets or sets the selected option.
LabelGets or sets the label shown by the component.
OrientationGets or sets the orientation.
IsRequiredGets or sets a value indicating whether the component is required for form submission.
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

NameDescription
RenderRenders the component's root HTML element.
AddAdds the given item to the component.
ClearClears the component's current state.
ReplaceReplaces an existing item with a new one.
ChoicesConfigures the component to choices.
HorizontalConfigures the component to horizontal.
VerticalConfigures the component to vertical.
RequiredMarks the component as required.
AsObservableReturns the component's state as a(n) observable.
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

© 2026 Curiosity. All rights reserved.