ModuLabry Logo

Umbraco-Suite by ModuLabry

NuGet

ML RadioButton List

The ML RadioButton List provides a clean, grid-based interface for selecting a single option from a list. It is the perfect choice for exclusive selections where all options should be visible at once.

⚙️ Configuration

Configure the editor in the Umbraco Data Type settings in the following order:

  • Selection Mode: Choose how you want to provide your data:
    • Items: Use the standard Umbraco "Dropdown" input configuration.
    • Simple: Enter a list of values, one per line (e.g., EN, DE, FR).
    • Enum: Enter the fully qualified name of your Enum including the namespace (e.g., MyProject.Models.Countries).
  • Translation Prefix: Add a prefix (e.g., Country.) to automatically look up translations in the Umbraco Dictionary.
  • Sort Alphabetically: If enabled, the options will be sorted A-Z based on their display labels (translated names) rather than the source order.
  • Display Inline: If enabled, the radio buttons are shown side-by-side in a flexible row instead of a vertical list.

💻 C# Data Retrieval (Value Converter)

Since radio buttons only allow a single selection, the value is always stored and retrieved as a simple string via the built-in Value Converter.

// Get the selected key from a ML RadioButton List
var content = Umbraco.Content("your-node-guid");
string selectedValue = content?.Value<string>("myRadioButtonList");
// Example Result: "FR"

✅ Validation

The ML RadioButton List fully integrates with the Umbraco validation system:

  • Supports the native Mandatory toggle.
  • If no option is selected, the component prevents saving and displays your custom validation message.
  • Clear visual feedback is provided in the backoffice UI if validation fails.

🔍 Usage Tip

Use the ML RadioButton List instead of a Dropdown when you have a small number of options (e.g., 2-5). It improves the user experience by making all choices visible with a single glance and reducing the number of clicks required.