ChoiceGroup
Radio
RadioButton
RadioGroup
RadioButtonGroup
Radio
RadioButton
RadioGroup
RadioButtonGroup
ChoiceGroup let people select a single option from two or more choices.
Notes
The BitChoiceGroup is a Multi-API component
which can accept the list of Items in 3 different ways:
1. The BitChoiceGroupItem class
2. A Custom Generic class
3. The BitChoiceGroupOption component
Usage
Basic
<BitChoiceGroup Label="Basic Items" Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Label="NoCircle" NoCircle Items="basicItems" DefaultValue="basicItems[1].Value" />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; }
Disabled
Illustrates how to disable the entire BitChoiceGroup and individual items.
<BitChoiceGroup Label="Disabled ChoiceGroup" IsEnabled="false" Items="basicItems" DefaultValue="@("A")" /> <BitChoiceGroup Label="ChoiceGroup with Disabled Items" Items="disabledItems" DefaultValue="@("A")" />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> disabledItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C", IsEnabled = false }, new() { Text = "Item D", Value = "D" } ]; }
Images and Icons
Showcases BitChoiceGroup with image and icon items.
Inline:
<BitChoiceGroup Label="Image Items" Items="imageItems" DefaultValue="@("Bar")" /> <BitChoiceGroup Label="Icon Items" Items="iconItems" DefaultValue="@("Day")" /> <BitChoiceGroup Label="Image Items" Items="inlineImageItems" DefaultValue="@("Bar")" Inline /> <BitChoiceGroup Label="Icon Items" Items="iconItems" DefaultValue="@("Day")" Inline />@code { private readonly List<BitChoiceGroupItem<string>> imageItems = [ new() { Text = "Bar", Value = "Bar", ImageAlt = "alt for Bar image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-selected.png", }, new() { Text = "Pie", Value = "Pie", ImageAlt = "alt for Pie image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-selected.png", } ]; private readonly List<BitChoiceGroupItem<string>> inlineImageItems = [ new() { Text = "Bar", Value = "Bar", ImageAlt = "alt for Bar image", ImageSize = new BitImageSize(20, 20), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-selected.png", }, new() { Text = "Pie", Value = "Pie", ImageAlt = "alt for Pie image", ImageSize = new BitImageSize(20, 20), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-selected.png", } ]; private readonly List<BitChoiceGroupItem<string>> iconItems = [ new() { Text = "Day", Value = "Day", IconName = BitIconName.CalendarDay }, new() { Text = "Week", Value = "Week", IconName = BitIconName.CalendarWeek }, new() { Text = "Month", Value = "Month", IconName = BitIconName.Calendar, IsEnabled = false } ]; }
Horizontal
Displays the BitChoiceGroup component in a horizontal layout, demonstrating various configurations.
<BitChoiceGroup Label="Basic" Items="basicItems" DefaultValue="@("A")" Horizontal /> <BitChoiceGroup Label="Disabled" Items="basicItems" IsEnabled="false" DefaultValue="@("A")" Horizontal /> <BitChoiceGroup Label="Image" Items="imageItems" DefaultValue="@("Bar")" Horizontal /> <BitChoiceGroup Label="Icon" Items="iconItems" DefaultValue="@("Day")" Horizontal />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> imageItems = [ new() { Text = "Bar", Value = "Bar", ImageAlt = "alt for Bar image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-selected.png", }, new() { Text = "Pie", Value = "Pie", ImageAlt = "alt for Pie image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-selected.png", } ]; private readonly List<BitChoiceGroupItem<string>> iconItems = [ new() { Text = "Day", Value = "Day", IconName = BitIconName.CalendarDay }, new() { Text = "Week", Value = "Week", IconName = BitIconName.CalendarWeek }, new() { Text = "Month", Value = "Month", IconName = BitIconName.Calendar, IsEnabled = false } ]; }
Reversed
Adjust the label position of BitChoiceGroup's item to be reversed.
<BitChoiceGroup Label="Reversed" Items="basicItems" DefaultValue="@("A")" Reversed Horizontal />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> imageItems = [ new() { Text = "Bar", Value = "Bar", ImageAlt = "alt for Bar image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-bar-selected.png", }, new() { Text = "Pie", Value = "Pie", ImageAlt = "alt for Pie image", ImageSize = new BitImageSize(32, 32), ImageSrc= "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-unselected.png", SelectedImageSrc = "https://static2.sharepointonline.com/files/fabric/office-ui-fabric-react-assets/choicegroup-pie-selected.png", } ]; private readonly List<BitChoiceGroupItem<string>> iconItems = [ new() { Text = "Day", Value = "Day", IconName = BitIconName.CalendarDay }, new() { Text = "Week", Value = "Week", IconName = BitIconName.CalendarWeek }, new() { Text = "Month", Value = "Month", IconName = BitIconName.Calendar, IsEnabled = false } ]; }
LabelTemplate
Demonstrates how to customize the label of the BitChoiceGroup using a template.
<style> .custom-label { color: red; font-size: 18px; font-weight: bold; } </style> <BitChoiceGroup Items="basicItems" DefaultValue="@("A")"> <LabelTemplate> <div class="custom-label"> Custom label <BitIcon IconName="@BitIconName.Filter" /> </div> </LabelTemplate> </BitChoiceGroup>@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; }
Item templates
Illustrates how to customize the appearance of BitChoiceGroup options using item templates.
<style> .custom-container { display: flex; align-items: center; gap: 10px; cursor: pointer; } .custom-circle { width: 20px; height: 20px; border: 1px solid; border-radius: 10px; } .custom-container:hover .custom-circle { border-top: 5px solid #C66; border-bottom: 5px solid #6C6; border-left: 5px solid #66C; border-right: 5px solid #CC6; } .custom-container.selected { color: #C66; } .custom-container.selected .custom-circle { border-top: 10px solid #C66; border-bottom: 10px solid #6C6; border-left: 10px solid #66C; border-right: 10px solid #CC6; } </style> <BitChoiceGroup Label="ItemPrefixTemplate" Items="basicItems" DefaultValue="@string.Empty"> <ItemPrefixTemplate Context="item"> @(item.Index + 1). </ItemPrefixTemplate> </BitChoiceGroup> <BitChoiceGroup Label="ItemLabelTemplate" Items="itemLabelTemplates" @bind-Value="itemLabelTemplateValue"> <ItemLabelTemplate Context="item"> <div class="custom-container @(itemLabelTemplateValue == item.Value ? "selected" : string.Empty)"> <BitIcon IconName="@item.IconName" /> <span>@item.Text</span> </div> </ItemLabelTemplate> </BitChoiceGroup> <BitChoiceGroup Label="ItemTemplate" Items="itemTemplateItems" @bind-Value="itemTemplateValue"> <ItemTemplate Context="item"> <div class="custom-container @(itemTemplateValue == item.Value ? "selected" : string.Empty)"> <div class="custom-circle"></div> <span>@item.Text</span> </div> </ItemTemplate> </BitChoiceGroup> <BitChoiceGroup Label="Item's Template" Items="itemTemplateItems2" @bind-Value="itemTemplateValue2" />@code { private string itemTemplateValue = "Day"; private string itemTemplateValue2 = "Day"; private string itemLabelTemplateValue = "Day"; private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> itemLabelTemplates = [ new() { Text = "Day", Value = "Day", IconName = BitIconName.CalendarDay }, new() { Text = "Week", Value = "Week", IconName = BitIconName.CalendarWeek }, new() { Text = "Month", Value = "Month", IconName = BitIconName.Calendar } ]; private readonly List<BitChoiceGroupItem<string>> itemTemplateItems = [ new() { Text = "Day", Value = "Day" }, new() { Text = "Week", Value = "Week" }, new() { Text = "Month", Value = "Month" } ]; private List<BitChoiceGroupItem<string>> itemTemplateItems2 = default!; protected override void OnInitialized() { itemTemplateItems2 = new() { new() { Text = "Day", Value = "Day", Template = (item => @<div class="custom-container @(itemTemplateValue2 == item.Value ? "selected" : "")"> <div class="custom-circle" /> <span style="color:red">@item.Text</span> </div>) }, new() { Text = "Week", Value = "Week", Template = (item => @<div class="custom-container @(itemTemplateValue2 == item.Value ? "selected" : "")"> <div class="custom-circle" /> <span style="color:green">@item.Text</span> </div>) }, new() { Text = "Month", Value = "Month", Template = (item => @<div class="custom-container @(itemTemplateValue2 == item.Value ? "selected" : "")"> <div class="custom-circle" /> <span style="color:blue">@item.Text</span> </div>) } }; } }
Binding
Shows how to use one-way and two-way data binding with BitChoiceGroup.
<BitChoiceGroup Label="One-way" Items="basicItems" Value="@oneWayValue" /> <BitTextField @bind-Value="oneWayValue" /> <BitChoiceGroup Label="Two-way" Items="basicItems" @bind-Value="twoWayValue" /> <BitTextField @bind-Value="twoWayValue" />@code { private string oneWayValue = "A"; private string twoWayValue = "A"; private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; }
Validation
Shows how to use data annotations for validating the selected value in BitChoiceGroup.
<style> .validation-message { color: red; } </style> <EditForm Model="@validationModel" OnValidSubmit="@HandleValidSubmit" OnInvalidSubmit="@HandleInvalidSubmit"> <DataAnnotationsValidator /> <BitChoiceGroup Items="basicItems" @bind-Value="validationModel.Value" /> <ValidationMessage For="@(() => validationModel.Value)" /> <BitButton ButtonType="BitButtonType.Submit">Submit</BitButton> </EditForm>@code { public class ChoiceGroupValidationModel { [Required(ErrorMessage = "Pick one")] public string Value { get; set; } } public ChoiceGroupValidationModel validationModel = new(); private void HandleValidSubmit() { } private void HandleInvalidSubmit() { } private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; }
Size
Varying sizes for BitChoiceGroup tailored to meet diverse design needs, ensuring flexibility and visual hierarchy within your interface.
Basic ChoiceGroup
ChoiceGroup with inline icon
ChoiceGroup with icon
<BitChoiceGroup Size="BitSize.Small" Label="Small" Items="basicItems" DefaultValue="basicItems[1].Value" Horizontal /> <BitChoiceGroup Size="BitSize.Medium" Label="Medium" Items="basicItems" DefaultValue="basicItems[1].Value" Horizontal /> <BitChoiceGroup Size="BitSize.Large" Label="Large" Items="basicItems" DefaultValue="basicItems[1].Value" Horizontal /> <BitChoiceGroup Size="BitSize.Small" Label="Small" Items="iconItems" DefaultValue="@("Day")" Horizontal Inline /> <BitChoiceGroup Size="BitSize.Medium" Label="Medium" Items="iconItems" DefaultValue="@("Day")" Horizontal Inline /> <BitChoiceGroup Size="BitSize.Large" Label="Large" Items="iconItems" DefaultValue="@("Day")" Horizontal Inline /> <BitChoiceGroup Size="BitSize.Small" Label="Small" Items="iconItems" DefaultValue="@("Day")" Horizontal /> <BitChoiceGroup Size="BitSize.Medium" Label="Medium" Items="iconItems" DefaultValue="@("Day")" Horizontal /> <BitChoiceGroup Size="BitSize.Large" Label="Large" Items="iconItems" DefaultValue="@("Day")" Horizontal />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> iconItems = [ new() { Text = "Day", Value = "Day", IconName = BitIconName.CalendarDay }, new() { Text = "Week", Value = "Week", IconName = BitIconName.CalendarWeek }, new() { Text = "Month", Value = "Month", IconName = BitIconName.Calendar, IsEnabled = false } ]; }
Color
Offering a range of specialized color variants with Primary being the default, providing visual cues for specific actions or states within your application.
<BitChoiceGroup Color="BitColor.Primary" Label="Primary" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Secondary" Label="Secondary" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Tertiary" Label="Tertiary" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Info" Label="Info" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Success" Label="Success" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Warning" Label="Warning" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.SevereWarning" Label="SevereWarning" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.Error" Label="Error" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.PrimaryBackground" Label="PrimaryBackground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.SecondaryBackground" Label="SecondaryBackground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.TertiaryBackground" Label="TertiaryBackground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.PrimaryForeground" Label="PrimaryForeground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.SecondaryForeground" Label="SecondaryForeground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.TertiaryForeground" Label="TertiaryForeground" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.PrimaryBorder" Label="PrimaryBorder" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.SecondaryBorder" Label="SecondaryBorder" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" /> <BitChoiceGroup Color="BitColor.TertiaryBorder" Label="TertiaryBorder" Horizontal Items="basicItems" DefaultValue="basicItems[1].Value" />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; }
Style & Class
Explores styling and class customization for BitChoiceGroup, including component styles, custom classes, and detailed style items.
Component's Style & Class:
Item's Style & Class:
Styles & Classes:
<style> .custom-class { color: dodgerblue; margin-inline: 16px; text-shadow: dodgerblue 0 0 8px; } .custom-item { padding: 8px; border-radius: 20px; border: 1px solid gray; } .custom-root { margin-inline: 16px; } .custom-text { font-weight: bold; } .custom-radio-btn::after { width: 8px; height: 8px; border: none; inset-inline-start: 6px; background-color: whitesmoke; } .custom-checked .custom-radio-btn::after { background-color: whitesmoke; } .custom-radio-btn::before { background-color: whitesmoke; } .custom-checked .custom-radio-btn::before { background-color: dodgerblue; } </style> <BitChoiceGroup Label="Styled ChoiceGroup" Items="basicItems" DefaultValue="basicItems[1].Value" Style="margin-inline: 16px; color:lightseagreen; text-shadow: lightseagreen 0 0 8px;" /> <BitChoiceGroup Label="Classed ChoiceGroup" Items="basicItems" DefaultValue="basicItems[1].Value" Class="custom-class" /> <BitChoiceGroup Items="itemStyleClassItems" DefaultValue="itemStyleClassItems[1].Value" /> <BitChoiceGroup Label="Styles" Items="basicItems" DefaultValue="basicItems[1].Value" Styles="@(new() { Root = "margin-inline: 16px; --item-background: #d3d3d347; --item-border: 1px solid gray;", ItemLabel = "width: 100%; cursor: pointer;", ItemChecked = "--item-background: #87cefa24; --item-border: 1px solid dodgerblue;", ItemContainer = "padding: 8px; border-radius: 2px; background-color: var(--item-background); border: var(--item-border);" })" /> <BitChoiceGroup Label="Classes" Items="basicItems" DefaultValue="basicItems[1].Value" Classes="@(new() { Root = "custom-root", ItemText = "custom-text", ItemChecked = "custom-checked", ItemRadioButton = "custom-radio-btn" })" />@code { private readonly List<BitChoiceGroupItem<string>> basicItems = [ new() { Text = "Item A", Value = "A" }, new() { Text = "Item B", Value = "B" }, new() { Text = "Item C", Value = "C" }, new() { Text = "Item D", Value = "D" } ]; private readonly List<BitChoiceGroupItem<string>> itemStyleClassItems = [ new() { Text = "Item A", Value = "A", Class = "custom-item" }, new() { Text = "Item B", Value = "B", Style = "padding: 8px; border-radius: 20px; border: 1px solid gray;" }, new() { Text = "Item C", Value = "C", Class = "custom-item" }, new() { Text = "Item D", Value = "D", Class = "custom-item" } ]; }
RTL
Use BitChoiceGroup in right-to-left (RTL).
<BitChoiceGroup Label="ساده" Items="rtlItems" DefaultValue="@("A")" Dir="BitDir.Rtl" /> <BitChoiceGroup Label="غیرفعال" Items="rtlItems" IsEnabled="false" DefaultValue="@("A")" Dir="BitDir.Rtl" />@code { private readonly List<BitChoiceGroupItem<string>> rtlItems = new() { new() { Text = "بخش آ", Value = "A" }, new() { Text = "بخش ب", Value = "B" }, new() { Text = "بخش پ", Value = "C" }, new() { Text = "بخش ت", Value = "D" } }; }
API
BitChoiceGroup parameters
Name |
Type |
Default value |
Description |
|---|---|---|---|
| AriaLabelledBy | string? | null | Id of an element to use as the aria label for the ChoiceGroup. |
| ChildContent | RenderFragment? | null | The content of the ChoiceGroup, a list of BitChoiceGroupOption components. |
| Classes | BitChoiceGroupClassStyles? | null | Custom CSS classes for different parts of the BitChoiceGroup. |
| Color | BitColor? | null | The general color of the ChoiceGroup. |
| DefaultValue | string? | null | Default selected Value for ChoiceGroup. |
| Inline | bool | false | Renders the icons and images in a single line with the items in the ChoiceGroup. |
| Horizontal | bool | false | Renders the items in the ChoiceGroup horizontally. |
| Items | IEnumerable<TItem> | new List<TItem>() | Sets the data source that populates the items of the list. |
| ItemLabelTemplate | RenderFragment<TItem>? | Used to customize the label for the Item Label content. | |
| ItemPrefixTemplate | RenderFragment<TItem>? | Used to add a prefix to each item. | |
| ItemTemplate | RenderFragment<TItem>? | null | Used to customize the label for the Item content. |
| Label | string? | null | The label for the ChoiceGroup. |
| LabelTemplate | RenderFragment? | null | Custom RenderFragment for the label of the ChoiceGroup. |
| Name | string | Guid.NewGuid().ToString() | Name of the ChoiceGroup, this unique name is used to group each item into the same logical component. |
| NameSelectors | BitChoiceGroupNameSelectors<TItem, TValue>? | null | Names and selectors of the custom input type properties. |
| NoCircle | bool | false | Removes the circle from the start of each item. |
| OnClick | EventCallback<MouseEventArgs> | Callback for when the option clicked. | |
| Options | RenderFragment? | null | Alias of ChildContent. |
| Reversed | bool | false | Reverses the label and radio button location. |
| Size | BitSize? | null | The size of the BitChoiceGroup. |
| Styles | BitChoiceGroupClassStyles? | null | Custom CSS styles for different parts of the BitChoiceGroup. |
BitInputBase parameters
Name |
Type |
Default value |
Description |
|---|---|---|---|
| DisplayName | string? | null | Gets or sets the display name for this field. |
| InputHtmlAttributes | IReadOnlyDictionary<string, object>? | null | Gets or sets a collection of additional attributes that will be applied to the created element. |
| Name | string? | null | Gets or sets the name of the element. Allows access by name from the associated form. |
| NoValidate | bool | false | Disables the validation of the input. |
| OnChange | EventCallback<TValue?> | Callback for when the input value changes. | |
| ReadOnly | bool | false | Makes the input read-only. |
| Required | bool | false | Makes the input required. |
| Value | TValue? | null | Gets or sets the value of the input. This should be used with two-way binding. |
BitInputBase public members
Name |
Type |
Default value |
Description |
|---|---|---|---|
| InputElement | ElementReference | The ElementReference of the input element. | |
| FocusAsync() | () => ValueTask | Gives focus to the input element. | |
| FocusAsync(bool preventScroll) | (bool preventScroll) => ValueTask | Gives focus to the input element. |
BitComponentBase parameters
Name |
Type |
Default value |
Description |
|---|---|---|---|
| AriaLabel | string? | null | The aria-label of the control for the benefit of screen readers. |
| Class | string? | null | Custom CSS class for the root element of the component. |
| Dir | BitDir? | null | Determines the component direction. |
| HtmlAttributes | Dictionary<string, object> | new Dictionary<string, object>() | Capture and render additional attributes in addition to the component's parameters. |
| Id | string? | null | Custom id attribute for the root element. if null the UniqueId will be used instead. |
| IsEnabled | bool | true | Whether or not the component is enabled. |
| Style | string? | null | Custom CSS style for the root element of the component. |
| Visibility | BitVisibility | BitVisibility.Visible | Whether the component is visible, hidden or collapsed. |
BitComponentBase public members
Name |
Type |
Default value |
Description |
|---|---|---|---|
| UniqueId | Guid | Guid.NewGuid() | The readonly unique id of the root element. it will be assigned to a new Guid at component instance construction. |
| RootElement | ElementReference | The ElementReference of the root element. |
BitChoiceGroupItem properties
Name |
Type |
Default value |
Description |
|---|---|---|---|
| AriaLabel | string? | null | AriaLabel attribute for the BitChoiceGroup item. |
| Class | string? | null | CSS class attribute for the BitChoiceGroup item. |
| Id | string? | null | Id attribute of the BitChoiceGroup item. |
| IsEnabled | bool | true | Whether the BitChoiceGroup item is enabled. |
| IconName | string? | null | The icon to show as content of the BitChoiceGroup item. |
| ImageSrc | string? | null | The image address to show as the content of the BitChoiceGroup item. |
| ImageAlt | string? | null | The alt attribute for the image of the BitChoiceGroup item. |
| ImageSize | BitImageSize? | null | Provides Width and Height for the image of the BitChoiceGroup item. |
| Prefix | string? | null | The text to show as a prefix for the BitChoiceGroup item. |
| SelectedImageSrc | string? | null | Provides a new image for the selected state of the image of the BitChoiceGroup item. |
| Style | string? | null | CSS style attribute for the BitChoiceGroup item. |
| Template | RenderFragment<BitChoiceGroupItem<TValue>>? | null | The custom template for the BitChoiceGroup item. |
| Text | string? | null | Text to show as the content of BitChoiceGroup item. |
| Value | string? | null | The value returned when BitChoiceGroup item is checked. |
| Index | int | null | Index of the BitChoiceGroup item. This property's value is set by the component at render. |
| IsSelected | bool | false | Determines if the item is selected. This property's value is assigned by the component. |
BitChoiceGroupOption properties
Name |
Type |
Default value |
Description |
|---|---|---|---|
| AriaLabel | string? | null | AriaLabel attribute for the BitChoiceGroup option. |
| Class | string? | null | CSS class attribute for the BitChoiceGroup option. |
| Id | string? | null | Id attribute of the BitChoiceGroup option. |
| IsEnabled | bool | true | Whether the BitChoiceGroup option is enabled. |
| IconName | string? | null | The icon to show as content of the BitChoiceGroup option. |
| ImageSrc | string? | null | The image address to show as the content of the BitChoiceGroup option. |
| ImageAlt | string? | null | The alt attribute for the image of the BitChoiceGroup option. |
| ImageSize | BitImageSize? | null | Provides Width and Height for the image of the BitChoiceGroup option. |
| Prefix | string? | null | The text to show as a prefix for the BitChoiceGroup option. |
| SelectedImageSrc | string? | null | Provides a new image for the selected state of the image of the BitChoiceGroup option. |
| Style | string? | null | CSS style attribute for the BitChoiceGroup option. |
| Template | RenderFragment<BitChoiceGroupOption<TValue>>? | null | The custom template for the BitChoiceGroup option. |
| Text | string? | null | Text to show as the content of BitChoiceGroup option. |
| Value | string? | null | The value returned when BitChoiceGroup option is checked. |
| Index | int | null | Index of the BitChoiceGroup option. This property's value is set by the component at render. |
| IsSelected | bool | false | Determines if the option is selected. This property's value is assigned by the component. |
BitChoiceGroupNameSelectors<TItem, TValue> properties
Name |
Type |
Default value |
Description |
|---|---|---|---|
| AriaLabel | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.AriaLabel)) | AriaLabel attribute for the BitChoiceGroup option. |
| Class | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.Class)) | CSS class attribute for the BitChoiceGroup option. |
| Id | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.Id)) | Id attribute of the BitChoiceGroup option. |
| IsEnabled | BitNameSelectorPair<TItem, bool> | new(nameof(BitChoiceGroupItem<TValue>.IsEnabled)) | Whether the BitChoiceGroup option is enabled. |
| IconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.IconName)) | The icon to show as content of the BitChoiceGroup option. |
| ImageSrc | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.ImageSrc)) | The image address to show as the content of the BitChoiceGroup option. |
| ImageAlt | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.ImageAlt)) | The alt attribute for the image of the BitChoiceGroup option. |
| ImageSize | BitNameSelectorPair<TItem, BitImageSize?> | new(nameof(BitChoiceGroupItem<TValue>.ImageSize)) | Provides Width and Height for the image of the BitChoiceGroup option. |
| SelectedImageSrc | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.SelectedImageSrc)) | Provides a new image for the selected state of the image of the BitChoiceGroup option. |
| Style | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.Style)) | CSS style attribute for the BitChoiceGroup option. |
| Template | BitNameSelectorPair<TItem, RenderFragment<TItem>?> | new(nameof(BitChoiceGroupItem<TValue>.Template)) | Template field name and selector of the custom input class. |
| Text | BitNameSelectorPair<TItem, string?> | new(nameof(BitChoiceGroupItem<TValue>.Text)) | Text to show as the content of BitChoiceGroup option. |
| Value | BitNameSelectorPair<TItem, TValue?> | new(nameof(BitChoiceGroupItem<TValue>.Value)) | The value returned when BitChoiceGroup option is checked. |
| Index | string | nameof(BitChoiceGroupItem<TValue>.Index)) | The Index field name of the custom input class. This property's value is set by the component at render. |
| IsSelected | string | nameof(BitChoiceGroupItem<TValue>.IsSelected)) | The IsSelected field name of the custom input class. This property's value is assigned by the component. |
BitChoiceGroupClassStyles properties
Name |
Type |
Default value |
Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the root element of the BitChoiceGroup. |
| LabelContainer | string? | null | Custom CSS classes/styles for the label container of the BitChoiceGroup. |
| Label | string? | null | Custom CSS classes/styles for the label of the BitChoiceGroup. |
| Container | string? | null | Custom CSS classes/styles for the container of the BitChoiceGroup. |
| ItemChecked | string? | null | Custom CSS classes/styles for the checked item of the BitChoiceGroup. |
| ItemContainer | string? | null | Custom CSS classes/styles for the container of each item of the BitChoiceGroup. |
| ItemLabel | string? | null | Custom CSS classes/styles for the label of each item of the BitChoiceGroup. |
| ItemImageContainer | string? | null | Custom CSS classes/styles for the image container of each item of the BitChoiceGroup. |
| ItemImageWrapper | string? | null | Custom CSS classes/styles for the image wrapper of each item of the BitChoiceGroup. |
| ItemRadioButton | string? | null | Custom CSS classes/styles for the radio button of each item of the BitChoiceGroup. |
| ItemImage | string? | null | Custom CSS classes/styles for the image of each item of the BitChoiceGroup. |
| ItemIconWrapper | string? | null | Custom CSS classes/styles for the icon wrapper of each item of the BitChoiceGroup. |
| ItemIcon | string? | null | Custom CSS classes/styles for the icon of each item of the BitChoiceGroup. |
| ItemPrefix | string? | null | Custom CSS classes/styles for the prefix of each item of the BitChoiceGroup. |
| ItemTextWrapper | string? | null | Custom CSS classes/styles for the text wrapper of each item of the BitChoiceGroup. |
| ItemText | string? | null | Custom CSS classes/styles for the text of each item of the BitChoiceGroup. |
BitColor enum
Name |
Value |
Description |
|---|---|---|
| Primary | 0 | Info Primary general color. |
| Secondary | 1 | Secondary general color. |
| Tertiary | 2 | Tertiary general color. |
| Info | 3 | Info general color. |
| Success | 4 | Success general color. |
| Warning | 5 | Warning general color. |
| SevereWarning | 6 | SevereWarning general color. |
| Error | 7 | Error general color. |
| PrimaryBackground | 8 | Primary background color. |
| SecondaryBackground | 9 | Secondary background color. |
| TertiaryBackground | 10 | Tertiary background color. |
| PrimaryForeground | 11 | Primary foreground color. |
| SecondaryForeground | 12 | Secondary foreground color. |
| TertiaryForeground | 13 | Tertiary foreground color. |
| PrimaryBorder | 14 | Primary border color. |
| SecondaryBorder | 15 | Secondary border color. |
| TertiaryBorder | 16 | Tertiary border color. |
BitSize enum
Name |
Value |
Description |
|---|---|---|
| Small | 0 | The small size checkbox. |
| Medium | 1 | The medium size checkbox. |
| Large | 2 | The large size checkbox. |
BitVisibility enum
Name |
Value |
Description |
|---|---|---|
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
BitDir enum
Name |
Value |
Description |
|---|---|---|
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
Feedback
You can give us your feedback through our GitHub repo by filing a new Issue or starting a new Discussion.
Or you can review / edit this page on GitHub.
Or you can review / edit this component on GitHub.
- On this page