docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class InputLabel

    A versatile label component for form inputs with support for required fields, help text, and various layout options.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    InputLabel
    NumericProperty<TValue, TField>
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.densityOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.SetActivePseudoState(bool)
    VisualElement.SetCheckedPseudoState(bool)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.IsMarkedForRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.SetBinding(BindingId, Binding)
    VisualElement.GetBinding(BindingId)
    VisualElement.TryGetBinding(BindingId, out Binding)
    VisualElement.GetBindingInfos()
    VisualElement.GetBindingInfos(List<BindingInfo>)
    VisualElement.HasBinding(BindingId)
    VisualElement.ClearBinding(BindingId)
    VisualElement.ClearBindings()
    VisualElement.GetHierarchicalDataSourceContext()
    VisualElement.GetDataSourceContext(BindingId)
    VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
    VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
    VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.disablePlayModeTint
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.scaledPixelsPerPoint
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.hasActivePseudoState
    VisualElement.hasInactivePseudoState
    VisualElement.hasHoverPseudoState
    VisualElement.hasCheckedPseudoState
    VisualElement.hasEnabledPseudoState
    VisualElement.hasDisabledPseudoState
    VisualElement.hasFocusPseudoState
    VisualElement.hasRootPseudoState
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.languageDirection
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.dataSource
    VisualElement.dataSourcePath
    VisualElement.dataSourceType
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.resolvedStyle
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, CallbackOptions)
    CallbackEventHandler.UnregisterAllRemovableCallbacks()
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    CallbackEventHandler.HandleEventBubbleUp(EventBase)
    CallbackEventHandler.HandleEventTrickleDown(EventBase)
    CallbackEventHandler.ExecuteDefaultAction(EventBase)
    CallbackEventHandler.NotifyPropertyChanged(in BindingId)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    [UxmlElement]
    public class InputLabel : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
    Remarks

    InputLabel is a specialized UI component designed to provide a consistent and accessible way to label form inputs. It combines a label with optional required field indicators and help text, making it ideal for form design and user input validation.

    The component supports both horizontal and vertical layouts, customizable label overflow behavior, and different styles of required field indicators to match your design system needs.

    Note: InputLabel is designed to work seamlessly with other form input components and follows accessibility best practices by maintaining proper label-input relationships.

    InputLabel is also the property row of the design system: a horizontal InputLabel with an optional leading icon, a draggable label that scrubs the numeric fields it wraps, and capValue to keep long property names readable on wide panels. For a labelled numeric row with the scrub wired in and impossible to forget, use NumericPropertyFloat or NumericPropertyInt.

    Examples

    A property row with a leading icon and a scrubbable label.

    <appui:InputLabel label="Opacity" icon="drop" draggable="true" cap-value="true">
        <appui:FloatField value="1" low-value="0" high-value="1" />
    </appui:InputLabel>

    Constructors

    InputLabel()

    Default constructor.

    Declaration
    public InputLabel()

    InputLabel(string)

    Constructor.

    Declaration
    public InputLabel(string label)
    Parameters
    Type Name Description
    string label

    The label value.

    Fields

    capValueUssClassName

    The InputLabel styling class applied when the input is width-capped.

    Declaration
    public const string capValueUssClassName = "appui-inputlabel--cap-value"
    Field Value
    Type Description
    string

    columnUssClassName

    The styling class given to each child of the control cell while columns hands the cell out as columns.

    Declaration
    public const string columnUssClassName = "appui-inputlabel__column"
    Field Value
    Type Description
    string

    columnsModeUssClassName

    The InputLabel styling class prefix carrying the columns mode.

    Declaration
    public const string columnsModeUssClassName = "appui-inputlabel--columns-"
    Field Value
    Type Description
    string

    columnsUssClassName

    The InputLabel styling class applied while its control cell is handed to the children as columns, in either Even or Pair.

    Declaration
    public const string columnsUssClassName = "appui-inputlabel--columns"
    Field Value
    Type Description
    string

    containerUssClassName

    The InputLabel container styling class.

    Declaration
    public const string containerUssClassName = "appui-inputlabel__container"
    Field Value
    Type Description
    string

    draggingUssClassName

    The InputLabel dragging styling class.

    Declaration
    public const string draggingUssClassName = "appui-inputlabel--dragging"
    Field Value
    Type Description
    string

    fieldLabelUssClassName

    The InputLabel field-label styling class.

    Declaration
    public const string fieldLabelUssClassName = "appui-inputlabel__field-label"
    Field Value
    Type Description
    string

    helpTextUssClassName

    The InputLabel help text styling class.

    Declaration
    public const string helpTextUssClassName = "appui-inputlabel__help-text"
    Field Value
    Type Description
    string

    iconUssClassName

    The InputLabel leading icon styling class.

    Declaration
    public const string iconUssClassName = "appui-inputlabel__icon"
    Field Value
    Type Description
    string

    inputAlignmentUssClassName

    The InputLabel input alignment styling class.

    Declaration
    public const string inputAlignmentUssClassName = "appui-inputlabel--input-alignment-"
    Field Value
    Type Description
    string

    inputContainerUssClassName

    The InputLabel input container styling class.

    Declaration
    public const string inputContainerUssClassName = "appui-inputlabel__input-container"
    Field Value
    Type Description
    string

    labelContainerUssClassName

    The InputLabel label container styling class.

    Declaration
    public const string labelContainerUssClassName = "appui-inputlabel__label-container"
    Field Value
    Type Description
    string

    orientationUssClassName

    The InputLabel direction styling class.

    Declaration
    public const string orientationUssClassName = "appui-inputlabel--"
    Field Value
    Type Description
    string

    pairLoneUssClassName

    The InputLabel styling class applied while a Pair cell holds a single control, which then keeps to the first of the two tracks.

    Declaration
    public const string pairLoneUssClassName = "appui-inputlabel--columns-pair-lone"
    Field Value
    Type Description
    string

    rowLayoutUssClassName

    The InputLabel row layout styling class.

    Declaration
    public const string rowLayoutUssClassName = "appui-inputlabel--layout-"
    Field Value
    Type Description
    string

    tallUssClassName

    The InputLabel styling class applied to a grid row taller than one row.

    Declaration
    public const string tallUssClassName = "appui-inputlabel--tall"
    Field Value
    Type Description
    string

    ussClassName

    The InputLabel main styling class.

    Declaration
    public const string ussClassName = "appui-inputlabel"
    Field Value
    Type Description
    string

    withHelpTextUssClassName

    The InputLabel with help text styling class.

    Declaration
    public const string withHelpTextUssClassName = "appui-inputlabel--with-help-text"
    Field Value
    Type Description
    string

    withIconUssClassName

    The InputLabel styling class applied when a leading icon is set.

    Declaration
    public const string withIconUssClassName = "appui-inputlabel--with-icon"
    Field Value
    Type Description
    string

    Properties

    capValue

    Whether the input is width-capped so that the label takes the freed space.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool capValue { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    By default the label occupies a fixed fraction of the row (--appui-inputlabel-label-size) and the input grows to fill the rest, so a wide panel stretches the input and truncates a long label. With capValue the label grows instead and the input is capped at --appui-inputlabel-input-max-size, which keeps long property names readable. Only affects the horizontal direction.

    columns

    Grid layout only: how the control cell is handed to the children.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public InputLabelColumns columns { get; set; }
    Property Value
    Type Description
    InputLabelColumns
    Remarks

    Even lays the children out in a row that shares the cell evenly; a child that needs a bigger share sets its own flex-grow, the UI Toolkit stand-in for a subgrid span. Pair splits the cell into exactly two equal halves with the inspector grid gap between them, for a slider and its number field, and the halves line up with the next pair row's.

    The registry's PropertyField takes columns: boolean | 'pair'. Three states do not fit a bool, so this is an enum.

    contentContainer

    The content container.

    Declaration
    public override VisualElement contentContainer { get; }
    Property Value
    Type Description
    VisualElement
    Overrides
    VisualElement.contentContainer

    direction

    The orientation of the label.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public Direction direction { get; set; }
    Property Value
    Type Description
    Direction

    draggable

    Whether the label is draggable to increment/decrement the value of child input fields.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool draggable { get; set; }
    Property Value
    Type Description
    bool

    helpMessage

    The error message to display.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string helpMessage { get; set; }
    Property Value
    Type Description
    string

    helpVariant

    The variant of the HelpText.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public HelpTextVariant helpVariant { get; set; }
    Property Value
    Type Description
    HelpTextVariant

    icon

    The name of an optional leading icon displayed before the label.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string icon { get; set; }
    Property Value
    Type Description
    string
    Remarks

    Use it to mark a property row with a glyph, the way an inspector row does. Set it to null or an empty string to remove the icon.

    indicatorType

    The requirement indicator to display.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public IndicatorType indicatorType { get; set; }
    Property Value
    Type Description
    IndicatorType

    inputAlignment

    The alignment of the input.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public Align inputAlignment { get; set; }
    Property Value
    Type Description
    Align

    inputContainer

    The container holding the input(s), between the label cell and the help text.

    Declaration
    public VisualElement inputContainer { get; }
    Property Value
    Type Description
    VisualElement

    label

    The label value.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string label { get; set; }
    Property Value
    Type Description
    string

    labelFor

    The name of the control this row labels. Set it and a click on the label operates that control, the way a click on an HTML <label for> toggles its checkbox.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string labelFor { get; set; }
    Property Value
    Type Description
    string
    Remarks

    The control is looked up inside this row first, then anywhere in the panel, and must be IPressable: a Checkbox, a Toggle or a Radio, for instance. A disabled control is left alone.

    Ignored while draggable is on, as the registry ignores labelFor while scrub is active: a drag that ends on the label would otherwise toggle the control at the end of every scrub, and a row only scrubs when its value is numeric, which is not a control a label click operates anyway.

    labelOverflow

    The text overflow mode.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public TextOverflow labelOverflow { get; set; }
    Property Value
    Type Description
    TextOverflow

    required

    Whether the input is required or not in the form. This will add an asterisk next to the label.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool required { get; set; }
    Property Value
    Type Description
    bool

    requiredText

    The requirement indicator to display.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string requiredText { get; set; }
    Property Value
    Type Description
    string

    rowLayout

    How the label and the control are laid out.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public InputLabelRowLayout rowLayout { get; set; }
    Property Value
    Type Description
    InputLabelRowLayout
    Remarks

    Grid puts the row on the inspector column grid, which is what makes a stack of rows share one set of column edges. capValue has no effect there: the token columns already size both cells, and capping the control would move the column edge on that row alone.

    A grid row keeps its leading icon inside the label cell rather than beside it, so the icon comes out of the label's share and the control still starts on the column edge.

    tall

    Grid layout only: a control taller than one row, a multi-line text area for instance. The row grows to fit it and aligns its cells to the top, so the label stays on the first line.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool tall { get; set; }
    Property Value
    Type Description
    bool

    Methods

    GetColumnsUssClassName(InputLabelColumns)

    Declaration
    public static string GetColumnsUssClassName(InputLabelColumns enumValue)
    Parameters
    Type Name Description
    InputLabelColumns enumValue
    Returns
    Type Description
    string

    GetInputAlignmentUssClassName(Align)

    Declaration
    public static string GetInputAlignmentUssClassName(Align enumValue)
    Parameters
    Type Name Description
    Align enumValue
    Returns
    Type Description
    string

    GetOrientationUssClassName(Direction)

    Declaration
    public static string GetOrientationUssClassName(Direction enumValue)
    Parameters
    Type Name Description
    Direction enumValue
    Returns
    Type Description
    string

    GetRowLayoutUssClassName(InputLabelRowLayout)

    Declaration
    public static string GetRowLayoutUssClassName(InputLabelRowLayout enumValue)
    Parameters
    Type Name Description
    InputLabelRowLayout enumValue
    Returns
    Type Description
    string

    RefreshColumnMarkers()

    Re-tags the children of the control cell: the first one renders without a leading gap, and each one is styled as a column while columns is on.

    Declaration
    public void RefreshColumnMarkers()
    Remarks

    This runs on every layout pass of that cell and, while columns is on, whenever the children change. Call it directly only after mutating the children when the markers are needed before the next frame.

    Implements

    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    RegisterUpdateCallbackExtensions.RegisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    RegisterUpdateCallbackExtensions.UnregisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    VisualElementExtensions.EnableDynamicTransform(VisualElement, bool)
    VisualElementExtensions.EnablePicking(VisualElement, bool)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContextProvider<T>(VisualElement, string)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement, string)
    VisualElementExtensions.GetExclusiveRootElement(VisualElement)
    VisualElementExtensions.GetLastAncestorOfType<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement, string)
    VisualElementExtensions.GetTooltipContent(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.HasAncestorOfType<T>(VisualElement, bool)
    VisualElementExtensions.HasAncestorsOfType<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement, string)
    VisualElementExtensions.IsInvisible(VisualElement)
    VisualElementExtensions.IsOnScreen(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, string, T)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipContent(VisualElement, VisualElementExtensions.TooltipContentCallback)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)