@molecule/app-typing-indicator-vue

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-vue

npm · Source on GitHub

How it works

@molecule/app-typing-indicator-vue 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.

import { createApp, defineComponent, h } from 'vue'
import { TypingIndicator } from '@molecule/app-typing-indicator-vue'

const App = defineComponent({
  setup() {
    const isTyping = true
    return () => h(TypingIndicator, { visible: isTyping, ariaLabel: 'Alice is typing…' })
  },
})

createApp(App).mount('#app')

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

Reference

Vue three-dot typing indicator for chat UIs.

Exports <TypingIndicator> — the Vue 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

import { createApp, defineComponent, h } from 'vue'
import { TypingIndicator } from '@molecule/app-typing-indicator-vue'

const App = defineComponent({
  setup() {
    const isTyping = true
    return () => h(TypingIndicator, { visible: isTyping, ariaLabel: 'Alice is typing…' })
  },
})

createApp(App).mount('#app')

Type

feature

Installation

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

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

Three-dot "typing…" animation. CSS-only (no library dependency) — uses @keyframes defined via inline style tag. Renders three dots that pulse in sequence. The stylesheet also turns the pulse off under prefers-reduced-motion: reduce, so the dots stay still for users who ask for less motion (WCAG 2.3.3) instead of relying on a host stylesheet.

The motion comes from the ClassMap's typingPulse recipe, read on every render as React's PulseDots reads it, and falls back to DEFAULT_TYPING_PULSE.

const TypingIndicator: DefineComponent<
  ExtractPropTypes<{
    visible: { type: PropType<boolean>; default: boolean }
    dotSize: { type: PropType<number>; default: number }
    durationMs: { type: PropType<number>; default: number }
    ariaLabel: { type: PropType<string | undefined> }
    className: PropType<string | undefined>
  }>,
  () => VNode | null,
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<
    ExtractPropTypes<{
      visible: { type: PropType<boolean>; default: boolean }
      dotSize: { type: PropType<number>; default: number }
      durationMs: { type: PropType<number>; default: number }
      ariaLabel: { type: PropType<string | undefined> }
      className: PropType<string | undefined>
    }>
  > &
    Readonly<{}>,
  { visible: boolean; dotSize: number; durationMs: number },
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>
  • props — Component props (see TypingIndicatorProps).

Returns: The typing indicator component.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-ui ^1.9.0
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.5.0 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-ui
  • @molecule/app-ui-vue
  • @molecule/app-vue
  • vue

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.