Class FloatLabelType
Defines the floating label behavior for input components, controlling how and when the label transitions from placeholder to floating position.
Inheritance
Namespace: Syncfusion.Blazor.Inputs
Assembly: Syncfusion.Blazor.dll
Syntax
public sealed class FloatLabelType : Enum
Remarks
The floating label provides enhanced user experience by transforming the placeholder text into a label that appears above the input field. This behavior helps maintain context while the user interacts with the input, ensuring they always know what information is expected. The different modes offer flexibility for various design patterns and user interaction preferences.
Examples
Setting floating label behavior:
<SfTextBox FloatLabelType="FloatLabelType.Auto" Placeholder="Enter your name"></SfTextBox>
Fields
Always
The label is permanently positioned above the input field, regardless of focus state or content.
Declaration
public const FloatLabelType Always
Field Value
Type | Description |
---|---|
FloatLabelType | Represents the "Always" floating label mode where the label is permanently positioned above the input. |
Remarks
In this mode, the label is always displayed above the input field, providing constant visual context for the expected input regardless of whether the field is focused or contains a value.
Auto
The label automatically transitions to a floating position above the input when the field receives focus or contains a value.
Declaration
public const FloatLabelType Auto
Field Value
Type | Description |
---|---|
FloatLabelType | Represents the "Auto" floating label mode where the label automatically transitions based on input state. |
Remarks
This is the most dynamic mode where the label starts as placeholder text and smoothly transitions to a floating position above the input when the user focuses on the field or when the field contains a value. This provides the best balance of space efficiency and user experience.
Never
The label remains static as a placeholder and never transitions to a floating position above the input.
Declaration
public const FloatLabelType Never
Field Value
Type | Description |
---|---|
FloatLabelType | Represents the "Never" floating label mode where the label stays as placeholder text. |
Remarks
When this mode is selected, the label text remains in the input field as placeholder text and does not move to a floating position above the input, even when the field is focused or contains a value.