Skip to content

Utilities

Params

Bit.BlazorUI

BitParams cascades shared default parameters to every bit BlazorUI component in a subtree, so a toolbar, a form or a whole app sets them once. Each component reads the params object of its own type (BitButtonParams, BitTagParams, ...), and a parameter it sets itself always wins.

Notes

A params object fills in only what a component leaves unset, one parameter at a time. BitParams re-reads its objects on every render and tells the components below only when a value actually changed, so rebuilding the list inline or changing a property of one of its objects is fine; a parameter an object stops setting goes back to what the component held before. For values of your own, use BitCascadingValueProvider.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

Every button and tag below takes its look from the params objects; the last button sets its own Variant, which wins.


Draft Internal

Changing values

The list can be written inline and rebuilt from state. Every component below follows the new values, and a value set back to null returns to the component's own.


Pending

Nesting

A nested BitParams only replaces the parameters it sets and keeps the rest from its ancestors. Isolated ignores the ancestors altogether.

Outer:
Nested (Color only):
Isolated:

API

Every parameter, public member, sub-class and enum this component exposes.

BitParams parameters

Name Type Default value Description
ChildContent RenderFragment? null The content to which the values should be provided.
Isolated bool false Ignores the params objects the BitParams ancestors provide, so the components below take their defaults from this one alone.
Parameters IEnumerable<IBitComponentParams>? null The params objects to provide, one per component type (BitButtonParams, BitTagParams, ...). A later or nested object of the same type only replaces the parameters it sets.

IBitComponentParams properties

Implemented by every <Component>Params class; its Name is what the component reads it by.

Name Type Default value Description
Name string The cascading name the component reads the params object by (its ParamName constant).

BitComponentBaseParams properties

The base class of every <Component>Params class: the parameters every component inherits from BitComponentBase. A null value is left unset.

Name Type Default value Description
AriaLabel string? null Gets or sets the accessible label for the component, used by assistive technologies. Every component that reads it is announced by the same name, so share it only between components that do the same thing.
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.
ForceAnimation bool? null 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>? null Additional HTML attributes for the root element. A nested object of the same type adds its entries to the outer ones.
Id string? null Gets or sets the unique identifier for the component's root element. Every component that reads it gets the same id, so share it only with a single component.
Disabled bool? null Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction.
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? null Gets or sets the visibility state (visible, hidden, or collapsed) of the component.

BitInputBaseParams<TValue> properties

The base class of the params of an input: BitComponentBaseParams plus the parameters every input inherits from BitInputBase. What identifies a single field (Value, Name, DisplayName) is left out.

Name Type Default value Description
ReadOnly bool? null Makes the input read-only.
Required bool? null Makes the input required.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.