Table of Contents

Method RadioButton

Namespace
Velvet
Assembly
Velvet.Docs.dll

RadioButton(string?, bool?, Action<bool>?, string?, string?, string?, bool?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)

Creates a RadioButton. An individual radio button used inside a RadioButtonGroup.

public static ElementNode RadioButton(string? className = null, bool? value = null, Action<bool>? onValueChanged = null, string? key = null, string? name = null, string? label = null, bool? enabled = null, Func<VisualElement, Action>? refCallback = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)

Parameters

className string

CSS-like utility class string. Multiple classes separated by spaces.

value bool?

Current selected state (controlled).

onValueChanged Action<bool>

Handler invoked when the radio button selection state changes.

key string

Key used to disambiguate siblings at the same position.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

label string

Label text shown next to the radio button.

enabled bool?

When false, disables user interaction with the radio button.

refCallback Func<VisualElement, Action>

Callback invoked on mount with the created VisualElement; returned Action runs on unmount.

whileHoverClass string

USS class toggled while the pointer hovers the element.

whileTapClass string

USS class toggled while the pointer is pressed on the element.

whileFocusClass string

USS class toggled while the element holds keyboard/UI focus.

data IReadOnlyDictionary<string, string>

data-* attribute map matched by data-[...] variants.

aria IReadOnlyDictionary<string, string>

aria-* attribute map matched by aria-[...] variants.

Returns

ElementNode

The created ElementNode representing this radio button.