Navs
Stepper
The Stepper component shows the steps of a process in their order - the ones done, the one the user is on and the ones still to come - horizontally or vertically, and lets the user go to a step by clicking it. What each step shows, and the buttons that move between them, are the page's.
Notes
1. The BitStepperItem class
2. A Custom Generic class, read through NameSelectors
3. The BitStepperOption component
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
Vertical
Description & icon
Linear
- Address
- Payment
- Review
ReadOnly
- AccountCompleted
- AddressCompleted
- Payment
- Review
Error & disabled
Events
Compact
External Icons
Style & Class
RTL
CSS variables
The public custom properties this component reads off its root, for what no parameter covers.
Every variable is read with a fallback and never declared by the component, so it inherits like any other custom property:
set one on :root (or in a [bit-theme] block) to restyle every instance, on any ancestor to restyle the ones inside it,
or on the Style of one instance to restyle it - and any instance nested inside it, which inherits the value too; a parameter changes one alone,
as does the real CSS property on the instance's Style / Styles when that property does not inherit (opacity: 1 keeps
one disabled instance undimmed without undimming a disabled one inside it), while an inherited one such as color or
font-family also reaches the nested instances that do not set it themselves. Leave a variable unset and the component
falls back to the theme token beside it.
BitStepper CSS variables
| Name | Default value | Description |
|---|---|---|
| --bit-Stepper-indicator-size | 2rem | Diameter of the indicator of a step. |
| --bit-Stepper-active-color | var(--bit-clr-pri) | Fill of the indicator of the completed and current steps, of the line after a completed step, and of their segments of the compact bar. |
| --bit-Stepper-active-text-color | var(--bit-clr-pri-text) | Number and icon color on the active fill. |
| --bit-Stepper-error-color | var(--bit-clr-err) | Fill of the indicator, and color of the text, of a step in error, and fill of its segment of the compact bar. |
| --bit-Stepper-connector-color | var(--bit-clr-brd-sec) | Color of the line between two steps, and of the segments of the upcoming steps in the compact bar. |
| --bit-Stepper-connector-width | var(--bit-shp-brd-width-thick) | Thickness of the line between two steps. |
API
Every parameter, public member, sub-class and enum this component exposes.
BitStepper parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| ChildContent | RenderFragment? | null | The content of the BitStepper, that are BitStepperOption components. |
| Classes | BitStepperClassStyles? | null | Custom CSS classes for the different parts of the stepper. |
| Compact | bool | false | Shows the current step alone in place of the list of every step: its position in words ("Step 2 of 4", from BitStrings.StepPositionFormat), its text and a bar with a segment per step. A Compact stepper is always compact, unless it is also Responsive and horizontal: then it is the layout taken while the stepper is narrower than 600px, in place of the vertical one, and the list of steps above that. Both are rendered and the stylesheet shows one of them through the container query of Responsive, so it works on a prerendered page too. The root of a Compact stepper is a group (a div carrying bit-str-cpt) rather than the list, which a Responsive one holds inside it (bit-str-lst). |
| CompactTemplate | RenderFragment<BitStepperCompactContext<TItem>>? | null | The content of the compact layout of a Compact stepper, in place of the position, the text and the bar it shows by default. It is given the index of the current step, the number of steps and the current step. |
| CompletedIcon | BitIconInfo? | null | The icon shown in the indicator of a completed step, using custom CSS classes for external icon libraries. Takes precedence over CompletedIconName. |
| CompletedIconName | string? | null | The name of the icon shown in the indicator of a completed step, from the built-in Fluent UI icons. Defaults to "CheckMark". |
| CurrentIndex | int | 0 | The index of the current step. The steps before it are completed and the ones after it are upcoming; an index past the last step shows every step completed, and a negative one shows none started. Two-way bindable. |
| ErrorIcon | BitIconInfo? | null | The icon shown in the indicator of a step in error, using custom CSS classes for external icon libraries. Takes precedence over ErrorIconName. |
| ErrorIconName | string? | null | The name of the icon shown in the indicator of a step in error, from the built-in Fluent UI icons. Defaults to "ErrorBadge". |
| Items | IEnumerable<TItem> | [] | The steps of the stepper. |
| Linear | bool | false | Keeps the user from skipping ahead: only the steps before the current one (and the current one) can be clicked, so a step is reached only by the page moving CurrentIndex forward. |
| NameSelectors | BitStepperNameSelectors<TItem>? | null | The names (or selectors) of the members the steps are read from, for items of a custom class. |
| OnChange | EventCallback<int> | The callback for when the user goes to another step, with its index. It runs even when CurrentIndex is bound one way and could not be written back. | |
| OnItemClick | EventCallback<TItem> | The callback for when a step is clicked, the current one included, as long as it can be gone to. | |
| Options | RenderFragment? | null | Alias of ChildContent: the steps declared as BitStepperOption components. |
| ReadOnly | bool | false | Only shows where the process is: no step can be clicked. |
| Responsive | bool | false | Lays the steps of a horizontal stepper out from top to bottom while the stepper is narrower than 600px, instead of letting a row that does not fit stick out of its container, and in a row again once it is wider. It is the width of the stepper's own container that decides, not the screen's, so one in a narrow sidebar or dialog is a column on a wide screen too. The stylesheet does the switch through a container query, so no BitMediaQuery is needed: the stepper stands in a wrapper (bit-str-rsw) that takes the full width of its container, and carries bit-str-rsp in place of bit-str-hrz. It has nothing to do on a Vertical stepper. On a Compact stepper, the compact layout is the one taken below 600px, in place of the vertical one. |
| Styles | BitStepperClassStyles? | null | Custom CSS styles for the different parts of the stepper. |
| Vertical | bool | false | Lays the steps out from top to bottom instead of from start to end. |
BitComponentBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | string? | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | BitDir? | null | Gets or sets the text directionality for the component's content. |
| Disabled | bool | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| ForceAnimation | bool | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | Dictionary<string, object> | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| Style | string? | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | string? | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | BitVisibility | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
BitComponentBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| UniqueId | Guid | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | ElementReference | Gets the reference to the root HTML element associated with this component. |
BitStepperItem properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | The aria-label of a step that can be clicked, which replaces its text, description and state as what a screen reader names it by. |
| Class | string? | null | The custom CSS classes of the step. |
| Description | string? | null | A second line of text under the text of the step. |
| Icon | BitIconInfo? | null | The icon shown in the indicator of the step in place of its number, using custom CSS classes for external icon libraries. Takes precedence over IconName. A step in error shows the error icon instead, and a completed step the completed icon. |
| IconName | string? | null | The name of the icon shown in the indicator of the step in place of its number, from the built-in Fluent UI icons. |
| IsDisabled | bool | false | Whether the step is disabled: it cannot be gone to, and is drawn dimmed. |
| IsError | bool | false | Whether the step is in error, shown with the error icon and color whatever the position of the step. |
| Key | string? | null | A unique value to use as the key of the step. |
| OnClick | Action<BitStepperItem>? | null | The click handler of the step, run when it is clicked and it can be gone to. |
| Style | string? | null | The custom CSS styles of the step. |
| Text | string? | null | The text of the step. |
| Title | string? | null | The title (tooltip) of the step. |
BitStepperOption properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | string? | null | The aria-label of a step that can be clicked, which replaces its text, description and state as what a screen reader names it by. |
| Class | string? | null | The custom CSS classes of the step. |
| Description | string? | null | A second line of text under the text of the step. |
| Icon | BitIconInfo? | null | The icon shown in the indicator of the step in place of its number, using custom CSS classes for external icon libraries. Takes precedence over IconName. |
| IconName | string? | null | The name of the icon shown in the indicator of the step in place of its number, from the built-in Fluent UI icons. |
| IsDisabled | bool | false | Whether the step is disabled: it cannot be gone to, and is drawn dimmed. |
| IsError | bool | false | Whether the step is in error, shown with the error icon and color whatever the position of the step. |
| Key | string? | null | A unique value to use as the key of the step. |
| OnClick | EventCallback<BitStepperOption> | The click handler of the step, run when it is clicked and it can be gone to. | |
| Style | string? | null | The custom CSS styles of the step. |
| Text | string? | null | The text of the step. |
| Title | string? | null | The title (tooltip) of the step. |
BitStepperNameSelectors properties
| Name | Type | Default value | Description |
|---|---|---|---|
| AriaLabel | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.AriaLabel)) | The AriaLabel field name and selector of the custom input class. |
| Class | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Class)) | The CSS Class field name and selector of the custom input class. |
| Description | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Description)) | The Description field name and selector of the custom input class. |
| Icon | BitNameSelectorPair<TItem, BitIconInfo?> | new(nameof(BitStepperItem.Icon)) | The Icon field name and selector of the custom input class. |
| IconName | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.IconName)) | The IconName field name and selector of the custom input class. |
| IsDisabled | BitNameSelectorPair<TItem, bool> | new(nameof(BitStepperItem.IsDisabled)) | The IsDisabled field name and selector of the custom input class. |
| IsError | BitNameSelectorPair<TItem, bool> | new(nameof(BitStepperItem.IsError)) | The IsError field name and selector of the custom input class. |
| Key | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Key)) | The Key field name and selector of the custom input class. |
| OnClick | BitNameSelectorPair<TItem, Action<TItem>?> | new(nameof(BitStepperItem.OnClick)) | The OnClick field name and selector of the custom input class. |
| Style | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Style)) | The CSS Style field name and selector of the custom input class. |
| Text | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Text)) | The Text field name and selector of the custom input class. |
| Title | BitNameSelectorPair<TItem, string?> | new(nameof(BitStepperItem.Title)) | The 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. |
BitStepperClassStyles properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the root element (the list of steps) of the BitStepper. |
| Step | string? | null | Custom CSS classes/styles for each step of the BitStepper. |
| CompletedStep | string? | null | Custom CSS classes/styles for each completed step of the BitStepper. |
| CurrentStep | string? | null | Custom CSS classes/styles for the current step of the BitStepper. |
| UpcomingStep | string? | null | Custom CSS classes/styles for each upcoming step of the BitStepper. |
| ErrorStep | string? | null | Custom CSS classes/styles for each step of the BitStepper that is in error. |
| Button | string? | null | Custom CSS classes/styles for the part of each step of the BitStepper that is clicked. |
| Indicator | string? | null | Custom CSS classes/styles for the indicator (the circle with the number or icon) of each step of the BitStepper. |
| Icon | string? | null | Custom CSS classes/styles for the icon in the indicator of each step of the BitStepper. |
| Number | string? | null | Custom CSS classes/styles for the number in the indicator of each step of the BitStepper. |
| Label | string? | null | Custom CSS classes/styles for the container of the text and description of each step of the BitStepper. |
| Text | string? | null | Custom CSS classes/styles for the text of each step of the BitStepper. |
| Description | string? | null | Custom CSS classes/styles for the description of each step of the BitStepper. |
| Connector | string? | null | Custom CSS classes/styles for the line connecting each step of the BitStepper to the next one. |
| Compact | string? | null | Custom CSS classes/styles for the compact part of a Compact BitStepper: the position, text and bar of the current step, or the content of its CompactTemplate. |
| Position | string? | null | Custom CSS classes/styles for the position of the current step ("Step 2 of 4") in the compact part of the BitStepper. |
| CompactText | string? | null | Custom CSS classes/styles for the text of the current step in the compact part of the BitStepper. |
| Progress | string? | null | Custom CSS classes/styles for the bar in the compact part of the BitStepper, which has a segment per step. |
| Segment | string? | null | Custom CSS classes/styles for each segment of the bar in the compact part of the BitStepper. |
BitStepperCompactContext<TItem> properties
The context passed to the CompactTemplate: where the process is, for the compact layout to show.
| Name | Type | Default value | Description |
|---|---|---|---|
| Index | int | 0 | The zero-based index of the current step, as the CurrentIndex of the stepper is: it is past the last step once every step is done, and negative while none is started. |
| Count | int | 0 | The number of steps. |
| Item | TItem? | null | The current step, or null while Index is outside the steps. |
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
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.