# TextRotator
**Also known as:** RotatingText, WordRotator, TextLoop
## Description
BitTextRotator cycles through a list of words or phrases in one place, moving each one out as the next one comes in. It always takes the width of its widest item, so the text around it never jumps; screen readers get every item as one stable text instead of a stream of changes; and under reduced motion it shows its first item, still.
## Parameters
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Classes | `BitTextRotatorClassStyles?` | null | Custom CSS classes for the different parts of the text rotator. |
| Element | `string?` | null | The custom html element used for the root node. The default is "span", which fits inside a sentence, a heading or a button; a value that is not a name a tag can have falls back to it. A void element (such as "br" or "img") holds no content, so no item is rendered into one. |
| Interval | `double` | 3000 | The time each item is shown for before the next one comes in, in ms, counted from the moment it starts to come in. A value that is not a positive number falls back to the default. |
| Items | `IEnumerable<string>?` | null | The words or phrases to rotate through, in order. The first one is shown before the rotation starts, while prerendering and under reduced motion; the rotation starts over from it whenever the items change. |
| Paused | `bool` | false | Holds the rotation on the item that is shown. It carries on from that item, after a whole Interval, once this is turned off again. A disabled rotator does not rotate either. |
| Styles | `BitTextRotatorClassStyles?` | null | Custom CSS styles for the different parts of the text rotator. |
| 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. |
## 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. |
## Enums
### 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. |
## Sub Classes
### BitTextRotatorClassStyles Properties
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| Root | `string?` | null | Custom CSS classes/styles for the root element of the BitTextRotator. |
| Item | `string?` | null | Custom CSS classes/styles for each item of the BitTextRotator. |
| CurrentItem | `string?` | null | Custom CSS classes/styles for the item of the BitTextRotator that is shown. |
## CSS Variables
Public CSS custom properties read off the component's root. Set one on `:root` to restyle every instance, on any ancestor to restyle the ones inside it, or on the `Style` of one instance to restyle it and every instance nested inside it, which inherits the value too - a parameter changes one alone, as does the real CSS property on its `Style` / `Styles` when that property does not inherit (`opacity`); an inherited one (`color`, `font-family`) reaches the nested instances that do not set it themselves.
| Name | Default Value | Description |
| :--- | :------------ | :---------- |
| `--bit-TextRotator-duration` | var(--bit-mot-duration-long) | Length of the entrance of an item, and of the exit played beside it. It collapses under reduced motion along with the motion tokens. |
| `--bit-TextRotator-easing` | var(--bit-mot-easing) | Curve of the entrance and the exit. |
| `--bit-TextRotator-distance` | 0.5em | How far an item travels: it comes in from below and goes out above, the other way round with a negative distance, and cross-fades in place with 0. |
| `--bit-TextRotator-disabled-opacity` | var(--bit-opa-dis) | Opacity of a rotator whose Disabled is true. |
## Examples
\n**Basic**:
```razor
Made for
```
\n**Transition**:
```razor
```
```csharp
private bool pauseAll;
private BitTextRotatorParams[] rotatorParams => [new() { Interval = 1500, Paused = pauseAll }];
```
\n**Style & Class**:
```razor
```
\n**RTL**:
```razor
Build apps for with one codebase.
Ship them as apps, even with reduced motion.
```
\n**Interval**:
```razor
A rotation of a second and a half.
A rotation of five seconds.
```
\n**Element**:
```razor
Items that come in from
Items that in place
Items that into place
```
\n**Paused**:
```razor
Pause me on
A disabled rotator:
```
```csharp
private bool isPaused;
```
\n**Command line**:
```razor
bit new MyApp
--database
--api
--module
```
\n**Cascading parameters**:
```razor
Fast at
Fast at
Slow at
ساخت برنامه برای با یک کد
```