Skip to content

AI

AiThinkingIndicator

Bit.BlazorUI.AITypingIndicator

BitAiThinkingIndicator is shown while the model is working but has produced nothing yet: three bouncing dots and a label, drawn at the size of the text around it. It is a polite live region, so a screen reader user learns that a response is coming without the announcement interrupting them. The label says Thinking by default, or whatever the app knows about the wait - a tool that is running, a status the transport reported.

Notes

To use this component, you need to install the Bit.BlazorUI.AI(opens in a new tab) nuget package, as described in the Optional steps of the Getting started page.

A chat message shows one by itself while its reply has not started. The indicator is a polite live region (role="status"): render it only while there is a wait to announce, and change its Label rather than rendering a new one, so a screen reader hears each status once. Under reduced motion the dots slow down rather than stop, since they are the only sign that work is still going on; ForceAnimation at the top of this page restores their pace. See the Streaming and Tools scenarios.

Usage

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

Basic

Three dots and the Thinking label of the BitAiStrings in force, drawn inline at the size of the text around it.

Thinking

Label

Label replaces the default text with what the app knows about the wait. It is what the live region announces.

Searching the documentation
Reading 3 attachments
Waiting for the weather service

While a reply is on its way

Shown from the moment a turn starts until its first text arrives. The scripted model below first reports a status (BitAiStatusEvent, kept as the StatusText of the message) and then calls a tool, and the label follows both; once the answer starts streaming, the indicator gives way to it.



Disabled

A Disabled indicator is drawn dimmed, its dots held still at the frame they had reached - for a wait the app has paused. It is still the live region that announces its label.

Paused until you reconnect

Cascading parameters

BitParams with a BitAiThinkingIndicatorParams sets the look of every indicator inside it - the ones a chat message renders included - and an indicator's own value still wins (the last one brings its own Styles). The Label is never cascaded: it says what one wait is about.

Thinking
Searching the documentation
Reading 3 attachments

Style & Class

Style and Class land on the root, Styles.Loading and Classes.Loading on the parts of the BitBouncingDotsLoading it draws (its dots and its label). The public --bit-AiThinkingIndicator-* variables set the color and the size of the label - the dots are drawn at that size - and the --bit-Loading-* ones the dots themselves.

Thinking
Thinking
Thinking
Thinking
Thinking

RTL

In right-to-left text the dots lead from the right and the label follows them - whether the direction comes from Dir or from a dir attribute around the indicator. The default label is the Thinking text of the BitAiStrings in force - here a subclass of them, cascaded by a BitAiOptionsProvider.

در حال جستجوی مستندات
در حال فکر کردن

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.

BitAiThinkingIndicator CSS variables

Name Default value Description
--bit-AiThinkingIndicator-color var(--bit-clr-fg-sec) Color of the label. The dots keep the color of the loader (--bit-Loading-color).
--bit-AiThinkingIndicator-font-size var(--bit-tpg-fs-sm) Size of the label, which the dots are drawn at too.

API

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

BitAiThinkingIndicator parameters

Name Type Default value Description
Classes BitAiThinkingIndicatorClassStyles? null Custom CSS classes for different parts of the thinking indicator.
Label string? null The text shown and announced beside the dots, for example the status of a running tool. Left null, the Thinking text of the BitAiStrings in force is shown.
Styles BitAiThinkingIndicatorClassStyles? null Custom CSS styles for different parts of the thinking indicator.

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.

BitAiThinkingIndicatorClassStyles properties

Name Type Default value Description
Root string? null Custom CSS classes/styles for the root element of the BitAiThinkingIndicator.
Loading BitLoadingClassStyles? null Custom CSS classes/styles for the parts of the BitBouncingDotsLoading the BitAiThinkingIndicator draws: its root (the live region), its dots (Container, Child) and its label.

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.