Spinner
Description
The Spinner component is a visual indicator that displays an animated circle outline, suggesting that a background process is running. It is commonly used when the duration of the task is unknown, serving as an indeterminate progress indicator. The Spinner supports various sizes and allows positioning of an associated label to provide additional context (for example, "Loading...", "Saving...", etc.). It is part of the Progress group in Tesserae's UI components.
Usage
Instantiate the Spinner component using the Tesserae.UI helper methods. You can create a spinner with initial text and further customize its size and label position. The following sample demonstrates a basic usage:
API reference
public class Spinner : ComponentBase<Spinner, HTMLDivElement>A spinner component used to indicate loading states.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<Spinner, HTMLDivElement> → Spinner
Constructors
| Name | Description |
|---|---|
| Spinner | Initializes a new instance of the Spinner class. |
Properties
| Name | Description |
|---|---|
| Position | Gets or sets the position of the label. |
| Size | Gets or sets the size of the spinner. |
| Text | Gets or sets the label text. |
public LabelPosition Position { get ; set ; }Gets or sets the position of the label.
Methods
| Name | Description |
|---|---|
| Success | Sets the spinner to indicate success. |
| Danger | Sets the spinner to indicate danger/error. |
| Primary | Sets the spinner to the primary color. |
| CustomColor | Configures the custom color on the component. |
| Progress | Sets the progress position (between 0 and total). |
| Indeterminate | Sets the spinner back to the normal indeterminate state. |
| Render | Renders the component. |
| Left | Sets the label position to left. |
| Right | Sets the label position to right. |
| Above | Sets the label position to above. |
| Below | Sets the label position to below. |
| XSmall | Sets the size to extra small. |
| Small | Sets the size to small. |
| Medium | Sets the size to medium. |
| Large | Sets the size to large. |
| SetText | Sets the label text. |
public Spinner Success()Sets the spinner to indicate success.
Returns
The current instance.
public Spinner Danger()Sets the spinner to indicate danger/error.
Returns
The current instance.
public Spinner Primary()Sets the spinner to the primary color.
Returns
The current instance.
public Spinner CustomColor(string color)Configures the custom color on the component.
| Overload | |
|---|---|
| Progress(int, int) | Sets the progress position (between 0 and total). |
| Progress(float) | Sets the progress percentage (between 0 and 100). |
public Spinner Indeterminate()Sets the spinner back to the normal indeterminate state.
Returns
The current instance.
public override HTMLElement Render()Renders the component.
Returns
The rendered HTML element.