Xui.ToolKit.UI.Widgets

Assembly: Xui.ToolKit.UI · C# declarations · Assembly overview

Types

class Button

A button that consumes design system tokens for colors, shape, and typography. Supports Xui.ToolKit.UI.Widgets.ButtonVariant (Filled, Outline, Text) and hover/pressed states.

public partial class Button
{
    protected override void OnActivate();
    protected override void AnimateCore(TimeSpan previous, TimeSpan current);
}
public partial class Button : View, IDesignSystemChangeNotifications
{
    public Button();
    public string Text { get; set; }
    public nfloat? FontSize { get; set; }
    public CornerRadius? CornerRadius { get; set; }
    public ColorRole Role { get; set; }
    public ButtonVariant Variant { get; set; }
    public TextAlign LabelTextAlign { get; set; }
    public Action? Clicked { get; set; }

    public event Action? ClickMaybe;
    public event Action? ClickFarFetch;
    public event Action? Click;
    public bool WaitForPressFeedback { get; set; }
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void RenderCore(IContext context);
    protected virtual Rect LabelBounds { get; }

    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

Button.Button()

public Button();

Creates a new button with content-sized alignment.

void Button.AnimateCore(TimeSpan previous, TimeSpan current)

protected override void AnimateCore(TimeSpan previous, TimeSpan current);

Override to animate this view and its children.

event Action? Button.Click

public event Action? Click;

Raised when the committed click executes, before the compatibility Clicked callback.

event Action? Button.ClickFarFetch

public event Action? ClickFarFetch;

Raised on a valid release, before Click. Start nonblocking preparation here.

event Action? Button.ClickMaybe

public event Action? ClickMaybe;

Raised once when press recognition allows the highlight to appear. The gesture may still cancel.

Action? Button.Clicked

public Action? Clicked { get; set; }

Invoked when the button is clicked.

CornerRadius? Button.CornerRadius

public CornerRadius? CornerRadius { get; set; }

Optional shape override; otherwise uses the design system.

int Button.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

NFloat? Button.FontSize

public nfloat? FontSize { get; set; }

Optional label size override; otherwise uses the design system.

View Button.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

Rect Button.LabelBounds

protected virtual Rect LabelBounds { get; }

The area available to the label, before applying the design system's padding.

TextAlign Button.LabelTextAlign

public TextAlign LabelTextAlign { get; set; }

Horizontal alignment of the button label. Default is centered.

Size Button.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void Button.OnActivate()

protected override void OnActivate();

Called when this view becomes active — it will receive events, render, and animate. Override this to start animations, subscribe to data sources, or acquire resources.

void Button.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void Button.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void Button.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Called during event dispatch to handle a pointer event in a specific event phase.

void Button.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

ColorRole Button.Role

public ColorRole Role { get; set; }

Which color group to use. Default is Primary.

string Button.Text

public string Text { get; set; }

The button label text.

ButtonVariant Button.Variant

public ButtonVariant Variant { get; set; }

Visual weight of the button. Default is Filled.

bool Button.WaitForPressFeedback

public bool WaitForPressFeedback { get; set; }

Waits for a highlighted render and the following animation tick before executing a quick click.

class ButtonGroup

A horizontal group of buttons that share a continuous border. Supports Xui.ToolKit.UI.Widgets.ButtonVariant (Filled, Outline, Text) and single selection.

public class ButtonGroup : ViewCollection, IDesignSystemChangeNotifications
{
    public int SelectedIndex { get; set; }
    public Action<int>? SelectionChanged { get; set; }
    public ColorRole Role { get; set; }
    public ButtonVariant Variant { get; set; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
}

void ButtonGroup.ArrangeCore(Rect rect, IMeasureContext context)

protected override void ArrangeCore(Rect rect, IMeasureContext context);

Override to arrange children within this view's final frame.

Size ButtonGroup.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void ButtonGroup.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void ButtonGroup.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void ButtonGroup.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

ColorRole ButtonGroup.Role

public ColorRole Role { get; set; }

Which color group to use. Default is Primary.

int ButtonGroup.SelectedIndex

public int SelectedIndex { get; set; }

Gets or sets the selected button index (0-based).

Action<int>? ButtonGroup.SelectionChanged

public Action<int>? SelectionChanged { get; set; }

Invoked when the selection changes.

ButtonVariant ButtonGroup.Variant

public ButtonVariant Variant { get; set; }

Visual style. Default is Outline.

class ButtonGroupItem

A single item inside a Xui.ToolKit.UI.Widgets.ButtonGroup. Renders only text — the group draws backgrounds.

public class ButtonGroupItem : View, IDesignSystemChangeNotifications
{
    public string Text { get; set; }
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

int ButtonGroupItem.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

View ButtonGroupItem.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

Size ButtonGroupItem.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void ButtonGroupItem.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void ButtonGroupItem.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void ButtonGroupItem.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Called during event dispatch to handle a pointer event in a specific event phase.

void ButtonGroupItem.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

string ButtonGroupItem.Text

public string Text { get; set; }

The item label.

enum ButtonVariant

Controls the visual weight of a button.

public enum ButtonVariant
{
    Filled,
    Outline,
    Text,
}

ButtonVariant.Filled

Filled

Filled background — highest visual weight. Default for primary actions.

ButtonVariant.Outline

Outline

Outline border only — medium visual weight. For secondary/grouped actions.

ButtonVariant.Text

Text

Text only — lowest visual weight. Background appears on hover/press only.

class Card

A card container that uses design system tokens for background, outline, shape, and padding. By default uses Surface colors. Set Xui.ToolKit.UI.Widgets.Card.Role to use a specific color group.

public class Card : View, IDesignSystemChangeNotifications
{
    public nfloat? Padding { get; set; }
    public bool ClipContent { get; set; }
    public bool UseCompositionGroup { get; set; }
    public nfloat ShadowExtent { get; set; }
    public Color ShadowColor { get; set; }
    public override Rect CullingFrame { get; }
    public View? Content { get; set; }
    public ColorRole? Role { get; set; }
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
}

void Card.ArrangeCore(Rect rect, IMeasureContext context)

protected override void ArrangeCore(Rect rect, IMeasureContext context);

Override to arrange children within this view's final frame.

bool Card.ClipContent

public bool ClipContent { get; set; }

Clips content to the rounded card outline, useful for content that reaches the edges.

View? Card.Content

public View? Content { get; set; }

The content view inside the card.

int Card.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

Rect Card.CullingFrame

public override Rect CullingFrame { get; }

Gets this view's conservative bounds in its parent coordinate space for render culling.

A container may override this when its rendered geometry differs from its layout frame. Computing the union of descendant culling frames is deliberately deferred: it can be more expensive than rendering for small subtrees.

View Card.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

Size Card.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void Card.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void Card.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

NFloat? Card.Padding

public nfloat? Padding { get; set; }

Content inset. Null uses the design system spacing; zero allows content to reach the card edges.

void Card.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

ColorRole? Card.Role

public ColorRole? Role { get; set; }

When null, the card uses Surface colors. When set, uses the specified color group's Container/OnContainer as background/foreground.

Color Card.ShadowColor

public Color ShadowColor { get; set; }

Color and opacity at the shadow's inner edge.

NFloat Card.ShadowExtent

public nfloat ShadowExtent { get; set; }

Outer shadow fade distance. Zero disables the shadow; layout size is unchanged.

bool Card.UseCompositionGroup

public bool UseCompositionGroup { get; set; }

Use a keyed native surface for this card's outline, shadow, and content.

class Checkbox

A checkbox with a checkmark drawn via path commands. Consumes design system tokens for colors, shape, and sizing.

public class Checkbox : View, IDesignSystemChangeNotifications
{
    public bool IsChecked { get; set; }
    public Action<bool>? Changed { get; set; }

    public Checkbox();
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

Checkbox.Checkbox()

public Checkbox();

Creates a checkbox with content-sized alignment.

Action<bool>? Checkbox.Changed

public Action<bool>? Changed { get; set; }

Invoked when the checked state changes.

int Checkbox.Count

public override int Count { get; }

Gets the number of child views, which is always zero.

bool Checkbox.IsChecked

public bool IsChecked { get; set; }

Gets or sets whether the checkbox is checked.

View Checkbox.this[int index]

public override View this[int index] { get; }

Gets a child view by index.

Throws Always thrown because a checkbox has no child views.: Always thrown because a checkbox has no child views.

Size Checkbox.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Measures the checkbox using its design-system-defined square size.

void Checkbox.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void Checkbox.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void Checkbox.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Updates pointer feedback and toggles the checked state on a completed tap.

void Checkbox.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Renders the checkbox box, border, and optional checkmark.

enum ColorRole

Selects which color group from the design system a widget should use.

public enum ColorRole
{
    Primary,
    Secondary,
    Tertiary,
    Warning,
    Error,
    Neutral,
}

ColorRole.Error

Error

Error / destructive state colors.

ColorRole.Neutral

Neutral

Low-contrast neutral colors for quiet buttons, toolbars, etc.

ColorRole.Primary

Primary

Brand / primary action colors.

ColorRole.Secondary

Secondary

Supporting / secondary action colors.

ColorRole.Tertiary

Tertiary

Tertiary highlight / accent colors.

ColorRole.Warning

Warning

Warning / caution state colors.

class Expander

A card-like container with a clickable title that expands/collapses its content with an animated transition. Consumes motion tokens from the design system.

public class Expander : View, IDesignSystemChangeNotifications
{
    public string Title { get; set; }
    public bool IsExpanded { get; set; }
    public View? Content { get; set; }
    public override int Count { get; }

    public override View this[int index] { get; }

    protected override void OnActivate();
    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

void Expander.AnimateCore(TimeSpan previousTime, TimeSpan currentTime)

protected override void AnimateCore(TimeSpan previousTime, TimeSpan currentTime);

Override to animate this view and its children.

void Expander.ArrangeCore(Rect rect, IMeasureContext context)

protected override void ArrangeCore(Rect rect, IMeasureContext context);

Override to arrange children within this view's final frame.

View? Expander.Content

public View? Content { get; set; }

The content view shown when expanded.

int Expander.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

bool Expander.IsExpanded

public bool IsExpanded { get; set; }

Gets or sets whether the expander is expanded.

View Expander.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

Size Expander.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void Expander.OnActivate()

protected override void OnActivate();

Called when this view becomes active — it will receive events, render, and animate. Override this to start animations, subscribe to data sources, or acquire resources.

void Expander.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void Expander.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void Expander.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Called during event dispatch to handle a pointer event in a specific event phase.

void Expander.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

string Expander.Title

public string Title { get; set; }

The title text shown in the header.

class ListView

A vertical list with selectable items, internally scrollable. Each Xui.ToolKit.UI.Widgets.ListViewItem supports hover and selection states using design system tokens.

public class ListView : View, IDesignSystemChangeNotifications
{
    public int SelectedIndex { get; set; }
    public Action<int>? SelectionChanged { get; set; }
    public ColorRole Role { get; set; }

    public ListView();
    public ReadOnlySpan<View> Content { init; }
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
}

ListView.ListView()

public ListView();

Initializes a list view with an internal scrollable content container.

void ListView.ArrangeCore(Rect rect, IMeasureContext context)

protected override void ArrangeCore(Rect rect, IMeasureContext context);

Override to arrange children within this view's final frame.

ReadOnlySpan<View> ListView.Content

public ReadOnlySpan<View> Content { init; }

The items to display. Set via collection initializer.

int ListView.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

View ListView.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

Size ListView.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void ListView.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void ListView.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void ListView.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

ColorRole ListView.Role

public ColorRole Role { get; set; }

Which color group to use for selection. Default is Primary.

int ListView.SelectedIndex

public int SelectedIndex { get; set; }

Gets or sets the selected item index (-1 for no selection).

Action<int>? ListView.SelectionChanged

public Action<int>? SelectionChanged { get; set; }

Invoked when the selection changes.

class ListViewItem

A single selectable item inside a Xui.ToolKit.UI.Widgets.ListView. Renders hover/selection backgrounds and hosts a content view.

public class ListViewItem : View, IDesignSystemChangeNotifications
{
    public View? ItemContent { get; set; }
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void ArrangeCore(Rect rect, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

void ListViewItem.ArrangeCore(Rect rect, IMeasureContext context)

protected override void ArrangeCore(Rect rect, IMeasureContext context);

Override to arrange children within this view's final frame.

int ListViewItem.Count

public override int Count { get; }

Returns the number of child views. Used by layout containers and traversal logic. Leaf views should return 0.

View ListViewItem.this[int index]

public override View this[int index] { get; }

Indexer to access child views by index. Layout containers should implement this to expose their children.

View? ListViewItem.ItemContent

public View? ItemContent { get; set; }

The content view displayed inside this item.

Size ListViewItem.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Override to compute the desired border-edge size.

void ListViewItem.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void ListViewItem.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void ListViewItem.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Called during event dispatch to handle a pointer event in a specific event phase.

void ListViewItem.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

class RadioButton

A radio button (circle with filled dot when selected). Consumes design system tokens for colors and sizing.

public class RadioButton : View, IDesignSystemChangeNotifications
{
    public bool IsSelected { get; set; }
    public Action<bool>? Changed { get; set; }

    public RadioButton();
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

RadioButton.RadioButton()

public RadioButton();

Creates a radio button with content-sized alignment.

Action<bool>? RadioButton.Changed

public Action<bool>? Changed { get; set; }

Invoked when the selection state changes.

int RadioButton.Count

public override int Count { get; }

Gets the number of child views, which is always zero.

bool RadioButton.IsSelected

public bool IsSelected { get; set; }

Gets or sets whether the radio button is selected.

View RadioButton.this[int index]

public override View this[int index] { get; }

Gets a child view by index.

Throws Always thrown because a radio button has no child views.: Always thrown because a radio button has no child views.

Size RadioButton.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Measures the radio button using its design-system-defined diameter.

void RadioButton.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void RadioButton.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void RadioButton.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Updates pointer feedback and selects the button on a completed tap.

void RadioButton.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Renders the selected or unselected radio-button indicator.

class TextInput

A design-system-aware text input. Uses the same Xui.Core.UI.Layer.FocusBorderLayer2+Xui.Core.UI.Layer.TextInputLayerlayer stack asXui.Core.UI.TextBox, but fills all visual properties from [Xui.ToolKit.UI.Design.IDesignSystem`](../xui-toolkit-ui-design/index.md#api-bf180554dd1b76ae) tokens instead of exposing them individually.

public class TextInput : LayerView<View, FocusBorderLayer<View, TextInputLayer>>, IDesignSystemChangeNotifications, ITextEditingClient
{
    public TextInput();
    public override bool Focusable { get; }
    public TextInputOptions InputOptions { get; set; }

    public bool CanPerformInputAction(TextInputAction action);
    public void PerformInputAction(TextInputAction action);
    public Xui.Core.UI.Input.TextEditingState Editor { get; }
    public bool NativeSelection { get; set; }
    public Rect InputBounds { get; }

    public Rect GetCaretRect(int offset, ITextMeasureContext measure);
    public int GetTextPosition(Point point, ITextMeasureContext measure);
    public bool HasText { get; }
    public string Text { get; set; }
    public bool IsPassword { get; set; }

    protected override Size MeasureCore(Size availableSize, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
}

TextInput.TextInput()

public TextInput();

Creates a text input with shared native editing state.

bool TextInput.CanPerformInputAction(TextInputAction action)

public bool CanPerformInputAction(TextInputAction action);

Whether a keyboard action is currently available.

TextEditingState TextInput.Editor

public Xui.Core.UI.Input.TextEditingState Editor { get; }

The document and selection shared with the native input system.

bool TextInput.Focusable

public override bool Focusable { get; }

Gets whether this view can receive keyboard focus via Tab navigation.

Rect TextInput.GetCaretRect(int offset, ITextMeasureContext measure)

public Rect GetCaretRect(int offset, ITextMeasureContext measure);

Returns the caret rectangle for a UTF-16 offset, in logical window coordinates.

int TextInput.GetTextPosition(Point point, ITextMeasureContext measure)

public int GetTextPosition(Point point, ITextMeasureContext measure);

Hit-tests a logical window point, returning a UTF-16 grapheme boundary.

bool TextInput.HasText

public bool HasText { get; }

Whether the input contains any text.

Rect TextInput.InputBounds

public Rect InputBounds { get; }

The input's hit-test bounds, in logical window coordinates.

TextInputOptions TextInput.InputOptions

public TextInputOptions InputOptions { get; set; }

Keyboard hints, applied when this field receives focus.

bool TextInput.IsPassword

public bool IsPassword { get; set; }

Gets or sets whether input is masked as a password.

Size TextInput.MeasureCore(Size availableSize, IMeasureContext context)

protected override Size MeasureCore(Size availableSize, IMeasureContext context);

Override to compute the desired border-edge size.

bool TextInput.NativeSelection

public bool NativeSelection { get; set; }

Whether a native interaction owns caret, selection handles, and touch selection.

void TextInput.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void TextInput.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void TextInput.PerformInputAction(TextInputAction action)

public void PerformInputAction(TextInputAction action);

Handles a keyboard action, including focus navigation or finishing editing.

void TextInput.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Override to render this view and its children.

string TextInput.Text

public string Text { get; set; }

Gets or sets the text content.

class Toggle

A toggle switch that slides a thumb circle between on/off positions. Consumes design system tokens for colors, shape, and sizing.

public class Toggle : View, IDesignSystemChangeNotifications
{
    public bool IsOn { get; set; }
    public Action<bool>? Changed { get; set; }

    public Toggle();
    public override int Count { get; }

    public override View this[int index] { get; }

    public void OnDesignTokenChange(DesignSystemChange changes);
    protected override void OnDeactivate();
    protected override Size MeasureCore(Size available, IMeasureContext context);
    protected override void RenderCore(IContext context);
    public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
}

Toggle.Toggle()

public Toggle();

Creates a toggle with content-sized alignment.

Action<bool>? Toggle.Changed

public Action<bool>? Changed { get; set; }

Invoked when the toggle value changes.

int Toggle.Count

public override int Count { get; }

Gets the number of child views, which is always zero.

bool Toggle.IsOn

public bool IsOn { get; set; }

Gets or sets whether the toggle is on.

View Toggle.this[int index]

public override View this[int index] { get; }

Gets a child view by index.

Throws Always thrown because a toggle has no child views.: Always thrown because a toggle has no child views.

Size Toggle.MeasureCore(Size available, IMeasureContext context)

protected override Size MeasureCore(Size available, IMeasureContext context);

Measures the toggle using its design-system-defined track dimensions.

void Toggle.OnDeactivate()

protected override void OnDeactivate();

Called when this view becomes dormant — it should stop animations, timers, and event subscriptions. The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).

void Toggle.OnDesignTokenChange(DesignSystemChange changes)

public void OnDesignTokenChange(DesignSystemChange changes);

Responds to the changed token groups without duplicating theme state on the view.

void Toggle.OnPointerEvent(ref PointerEventRef e, EventPhase phase)

public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);

Updates pointer feedback and changes the toggle value on a completed tap.

void Toggle.RenderCore(IContext context)

protected override void RenderCore(IContext context);

Renders the toggle track and thumb for its current state.