@molecule/app-typing-indicator-svelte

Feature · typing-indicator · App (browser) · v1.2.1 · Apache-2.0

Three-dot animated typing indicator for chat UIs

npm install @molecule/app-typing-indicator-svelte

npm · Source on GitHub

How it works

@molecule/app-typing-indicator-svelte is a ready-made typing-indicator feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

<script lang="ts">
  import { TypingIndicator } from '@molecule/app-typing-indicator-svelte'

  let isTyping = $state(true)
</script>

<TypingIndicator visible={isTyping} ariaLabel="Alice is typing…" />

Works with: @molecule/app-svelte, @molecule/app-ui, @molecule/app-ui-svelte

Reference

Svelte three-dot typing indicator for chat UIs.

Exports <TypingIndicator> — the Svelte counterpart of @molecule/app-typing-indicator-react: CSS-only three-dot pulse animation, the same props (React names) and the same DOM for the same input.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

<script lang="ts">
  import { TypingIndicator } from '@molecule/app-typing-indicator-svelte'

  let isTyping = $state(true)
</script>

<TypingIndicator visible={isTyping} ariaLabel="Alice is typing…" />

Type

feature

Installation

npm install @molecule/app-typing-indicator-svelte @molecule/app-svelte @molecule/app-ui @molecule/app-ui-svelte svelte

API

Interfaces

TypingIndicatorProps

Props accepted by the TypingIndicator component.

interface TypingIndicatorProps {
  /** Whether to render. Defaults to true. */
  visible?: boolean
  /** Dot diameter in pixels. Defaults to 6. */
  dotSize?: number
  /** Animation duration in ms. Defaults to 1200. */
  durationMs?: number
  /**
   * Accessible label. Overrides the translated / `defaultValue` `'Typing…'`
   * (prop > `t()` > default).
   */
  ariaLabel?: string
  /** Extra classes. */
  className?: string
}

Constants

TypingIndicator

const TypingIndicator: LegacyComponentType

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-svelte ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.9.0
  • @molecule/app-ui-svelte ^1.1.0
  • svelte ^5.0.0

Runtime Dependencies

  • @molecule/app-svelte
  • @molecule/app-ui
  • @molecule/app-ui-svelte
  • svelte

Dots use currentColor, so the indicator inherits the surrounding text color — wrap it in a muted-text container to dim it. The default ariaLabel is the translated typingIndicator.aria.label (English 'Typing…', via @molecule/app-locales-typing-indicator); the ariaLabel prop overrides it. Each instance injects its own <style> tag for the keyframes (fine for a chat view; avoid hundreds at once). Props (documented on the exported TypingIndicatorProps interface): visible (default true), dotSize (px, default 6), durationMs (default 1200), ariaLabel, className.

Translations

Translation strings are provided by @molecule/app-locales-typing-indicator.