summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/typewriter.stories.tsx
blob: 880ca74894341e1912a742c738430a4d80ed8862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// @ts-nocheck
import * as mod from "./typewriter"
import { create } from "../storybook/scaffold"

const docs = `### Overview
Animated typewriter text effect for short inline messages.

Use for short status lines; avoid long paragraphs.

### API
- Optional: \`text\` string; if absent, nothing is rendered.
- Optional: \`as\` to change the rendered element.

### Variants and states
- Single animation style with cursor blink.

### Behavior
- Types one character at a time with randomized delays.

### Accessibility
- TODO: confirm if cursor should be aria-hidden in all contexts.

### Theming/tokens
- Uses \`blinking-cursor\` class for cursor styling.

`

const story = create({ title: "UI/Typewriter", mod, args: { text: "Typewriter text" } })

export default {
  title: "UI/Typewriter",
  id: "components-typewriter",
  component: story.meta.component,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component: docs,
      },
    },
  },
}

export const Basic = story.Basic

export const Inline = {
  args: {
    text: "Inline typewriter",
    as: "span",
  },
}