Blazor EnumInput

The Blazor Bootstrap EnumInput component renders a dropdown list from an enumeration (enum), enabling users to select from a predefined set of options. It simplifies data entry by binding directly to enum types and supports customization with sizes.

How it works #

The EnumInput component displays enum values in a dropdown, allowing users to select from a predefined set of options.
How to use:
  1. Define an enum representing your options.
  2. Add the EnumInput component to your page, specifying the TEnum type parameter.
  3. Bind the selected value using @bind-Value or @bind-Text as needed.
  4. Use the selected value or text in your logic as shown in the demo.
This demo shows how to bind both the enum value and text, and how to display the selected result.

Sizes #

The EnumInput component can be rendered in various sizes to fit different UI requirements.
How to use:
  1. Set the Size parameter to one of the EnumInputSize values (Small, Normal, Large).
  2. Bind the selected value as needed.
This demo shows how to display EnumInput in different sizes for flexible layout integration.

Disabled #

The EnumInput component can be disabled to prevent user interaction.

How to use:
  1. Set the Disabled parameter to true to make the dropdown non-interactive.
  2. Bind the value as usual; the user will not be able to change it.
This demo demonstrates how to render EnumInput in a disabled state.

Events #

The EnumInput component supports event callbacks for value and text changes, enabling custom logic when the selection changes.
How to use (ValueChanged):
  1. Set the Value parameter and handle the ValueChanged event to respond to selection changes.
  2. Update your logic based on the new value in the event handler.
This demo shows how to handle value changes using the ValueChanged event.
How to use (TextChanged):
  1. Set the Text parameter and handle the TextChanged event to respond to text changes.
  2. Update your logic based on the new text in the event handler.
This demo shows how to handle text changes using the TextChanged event.

Mehods #

The EnumInput component can be enabled or disabled dynamically at runtime.
How to use:
  1. Bind the Disabled parameter to a boolean property in your component.
  2. Update the property in your code (e.g., via button click) to enable or disable the EnumInput as needed.
This demo demonstrates how to programmatically enable or disable the EnumInput component.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.