ButtonGroup
The ButtonGroup component can be used to group related buttons.
Notes
The BitButtonGroupGroup is a Multi-API component which can accept the list of Items in 3 different ways: BitButtonGroupGroupItem class, a custom Generic class, and BitButtonGroupGroupOption component.Usage
Basic
The buttons can be grouped by putting them in a ButtonGroup component.
Variant
The ButtonGroup has three variants: Fill (default), Outline, and Text..
Fill (default)
Outline
Text
Icon
Each item in the ButtonGroup can have an icon.
Fill (default)
Outline
Text
IconOnly
The IconOnly allows buttons to display only icons without any text, ideal for minimalistic designs or limited space.
Fill (default)
Outline
Text
Alternatively, each button can be set to IconOnly by simply leaving the text field empty.
Fill (default)
Outline
Text
ReversedIcon
Reverses the positions of the icon and the main content of the button.
Fill (default)
Outline
Text
Toggle
The Toggle in BitButtonGroup allows you to control the active or inactive state of each button, providing clear visual feedback to users about which buttons are selected or currently in use.
Fill (default)
Outline
Text
Vertical
By default the BitButtonGroup component is horizontal, but can be turned vertical by adding the Vertical property.
Events
Managing button click events.
Component's ItemClick event:
Clicked item:
Item's Click event:
Click count: 0
Size
Different sizes for buttons to meet design needs, ensuring flexibility within your application.
Small
Medium
Large
FullWidth
Setting the FullWidth makes the button group occupy 100% of its container's width.
Color
Offering a range of specialized colors, providing visual cues for specific states within your application.
Primary
Secondary
Tertiary
Info
Success
Warning
SevereWarning
Error
PrimaryBackground
SecondaryBackground
TertiaryBackground
PrimaryForeground
SecondaryForeground
TertiaryForeground
PrimaryBorder
SecondaryBorder
TertiaryBorder
Style & Class
Empower customization by overriding default styles and classes, allowing tailored design modifications to suit specific UI requirements.
Component's style & class:
Item's style & class:
Styles & Classes:
RTL
Use BitButtonGroup in right-to-left (RTL).
API
BitButtonGroup parameters
Name |
Type |
Default value |
Description |
---|---|---|---|
ChildContent | RenderFragment? | null | The content of the BitButtonGroup, that are BitButtonGroupOption components. |
IconOnly | bool | false | Determines that only the icon should be rendered. |
Classes | BitButtonGroupClassStyles? | null | Custom CSS classes for different parts of the ButtonGroup. |
Color | BitColor? | null | The general color of the button group. |
FullWidth | bool | false | Expand the ButtonGroup width to 100% of the available width. |
Items | IEnumerable<TItem> | new List<TItem>() | List of Item, each of which can be a Button with different action in the ButtonGroup. |
ItemTemplate | RenderFragment<TItem>? | null | The content inside the item can be customized. |
NameSelectors | BitButtonGroupNameSelectors<TItem>? | null | Names and selectors of the custom input type properties. |
OnItemClick | EventCallback<TItem> | The callback that is called when a button is clicked. | |
Options | RenderFragment? | null | Alias of ChildContent. |
Toggle | bool | false | Display ButtonGroup with toggle mode enabled for each button. |
Size | BitSize | null | The size of ButtonGroup, Possible values: Small | Medium | Large. |
Styles | BitButtonGroupClassStyles? | null | Custom CSS styles for different parts of the ButtonGroup. |
Variant | BitVariant? | null | The visual variant of the button group. |
Vertical | bool | false | Defines whether to render ButtonGroup children vertically. |
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. |
BitButtonGroupClassStyles properties
Name |
Type |
Default value |
Description |
---|---|---|---|
Root | string? | null | Custom CSS classes/styles for the root element of the BitButtonGroup. |
Button | string? | null | Custom CSS classes/styles for the internal button of the BitButtonGroup. |
Icon | string? | null | Custom CSS classes/styles for the icon of the BitButtonGroup. |
Text | string? | null | Custom CSS classes/styles for the text of the BitButtonGroup. |
ToggledButton | string? | null | Custom CSS classes/styles for the button when in toggle mode of the BitButtonGroup. |
BitButtonGroupNameSelectors properties
Name |
Type |
Default value |
Description |
---|---|---|---|
Class | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.Class)) | The CSS Class field name and selector of the custom input class. |
IconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.IconName)) | IconName field name and selector of the custom input class. |
IsEnabled | BitNameSelectorPair<TItem, bool> | new(nameof(BitButtonGroupItem.IsEnabled)) | IsEnabled field name and selector of the custom input class. |
Key | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.Key)) | Key field name and selector of the custom input class. |
OffIconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OffIconName)) | OffIconName field name and selector of the custom input class. |
OffText | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OffText)) | OffText field name and selector of the custom input class. |
OffTitle | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OffTitle)) | OffTitle field name and selector of the custom input class. |
OnIconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OnIconName)) | OnIconName field name and selector of the custom input class. |
OnText | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OnText)) | OnText field name and selector of the custom input class. |
OnTitle | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.OnTitle)) | OnTitle field name and selector of the custom input class. |
OnClick | BitNameSelectorPair<TItem, Action<TItem>?> | new(nameof(BitButtonGroupItem.OnClick)) | OnClick field name and selector of the custom input class. |
ReversedIcon | BitNameSelectorPair<TItem, bool> | new(nameof(BitButtonGroupItem.ReversedIcon)) | ReversedIcon field name and selector of the custom input class. |
Style | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.Style)) | Style field name and selector of the custom input class. |
Template | BitNameSelectorPair<TItem, RenderFragment?> | new(nameof(BitButtonGroupItem.Template)) | Template field name and selector of the custom input class. |
Text | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.Text)) | Text field name and selector of the custom input class. |
Title | BitNameSelectorPair<TItem, string?> | new(nameof(BitButtonGroupItem.Title)) | Title field name and selector of the custom input class. |
BitNameSelectorPair properties
Name |
Type |
Default value |
Description |
---|---|---|---|
Name | string | Custom class property name. | |
Selector | Func<TItem, TProp?>? | Custom class property selector. |
BitVariant enum
Name |
Value |
Description |
---|---|---|
Fill | 0 | Fill styled variant. |
Outline | 1 | Outline styled variant. |
Text | 2 | Text styled variant. |
BitColor enum
Name |
Value |
Description |
---|---|---|
Primary | 0 | 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 | Severe Warning 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. |
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. |
- On this page