---
title: "ChatShimmer"
description: "Добавляет тексту эффект мерцающей загрузки."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/chat-shimmer"
---
# ChatShimmer

> Добавляет тексту эффект мерцающей загрузки.

## Использование

Компонент ChatShimmer отрисовывает элемент с анимированным мерцающим градиентом поверх текста. Обычно так показывают поток ответа или загрузку в чатах.

> [!NOTE]
> Компоненты [`ChatTool`](https://b24-ui.bx-shef.by/raw/docs/components/chat-tool.md) и [`ChatReasoning`](https://b24-ui.bx-shef.by/raw/docs/components/chat-reasoning.md) используют его автоматически во время потока.

> [!TIP]
> Если пользователь предпочитает уменьшенную анимацию, анимация отключается, а текст показывается статичным приглушённым цветом.

### Текст

Пропс `text` задаёт мерцающий текст.

```vue
<template>
  <B24ChatShimmer text="Думаю..." />
</template>
```

### Длительность

Пропс `duration` задаёт скорость анимации в секундах.

```vue
<template>
  <B24ChatShimmer text="Думаю..." :duration="4" />
</template>
```

### Ширина блика

Пропс `spread` задаёт ширину блика. Фактическая ширина в пикселях считается как `text.length * spread`.

```vue
<template>
  <B24ChatShimmer text="Думаю..." :spread="5" />
</template>
```

## Примеры

> [!TIP]
> See: /docs/components/chat/
> Установка, настройка сервера и примеры использования — на обзорной странице **Chat**.

## API

### Пропсы

```ts
/**
 * Props for the ChatShimmer component
 */
interface ChatShimmerProps {
  /**
   * The text to display with the shimmer effect.
   */
  text: string;
  /**
   * The element or component this component should render as.
   * @default 'span'
   */
  as?: any;
  /**
   * The duration of the shimmer animation in seconds.
   * @default 2
   */
  duration?: number | undefined;
  /**
   * The spread multiplier for the shimmer highlight. The actual spread is computed as `text.length * spread` in pixels.
   * @default 2
   */
  spread?: number | undefined;
  b24ui?: {} | undefined;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    chatShimmer: {
      base: 'text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--b24ui-typography-label-color),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-color-design-plain-na-content-secondary),var(--ui-color-design-plain-na-content-secondary))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted'
    }
  }
})
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
