Skip to content

ThoughtChain Component ๐Ÿ”— โ€‹

Introduction โ€‹

ThoughtChain is a timeline component used to display AI thinking processes, supporting state management, content expand/collapse, and dynamic style configuration. Through visual thinking step sequences, it helps users intuitively understand complex logical flows. The component has built-in multiple state feedback, transition animations, and extension slots, suitable for intelligent conversations, data analysis, process guidance, and other scenarios.

Code Examples โ€‹

Basic Usage โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Failed - Main Title
    Thinking Content Title
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Control rendering by passing an array through thinkingItems.

๐Ÿ’Œ Info

id is a required field. You can also set the unique identifier name through rowKey, default is id.

Dot Size Control โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Hide Main Title, Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Hide Main Title, Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Default value is default, optional values are small, default, large.

Max Width Control โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Set the maximum width of the thought chain, default is '500px'. String type, meaning you can pass percentages like '50%', or other units, even CSS calculated width like 'calc(100% - 200px)'.

Custom Title and Content โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Thank You - Main Title
    Thinking Content Title
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Through the titleKey, thinkTitleKey, and thinkContentKey properties, you can customize the key names for: title, thinking content title, and thinking content of nodes.

Extension Slots โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Thank You - Main Title
    Thinking Content Title
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Through the #icon slot, you can customize icons for different states. You can get the current state through #icon={item}.

Manual Expand State Control โ€‹

  • Success - Main Title
    Thinking Content Title - Default Expanded
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text
  • Loading - Main Title
  • Failed - Main Title
  • Thank You - Main Title
    Thinking Content Title
    Search textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch textSearch text

Through the handleExpand event, you can get the currently expanded node data.

Attributes โ€‹

  • Component Attributes
ParameterTypeDefaultDescription
thinkingItemsArray<ThoughtChainItemBase>[]Thinking items array
dotSize'small'/'default'/'large''default'Timeline dot size
maxWidthstring'600px'Maximum width
lineGradientbooleanfalseWhether to enable line color gradient
rowKeystring'id'Data item unique identifier field
titleKeystring'title'Title field name
thinkTitleKeystring'thinkTitle'Thinking title field name
thinkContentKeystring'thinkContent'Thinking content field name
  • ThoughtChainItemBase Array item type definition
ParameterTypeDefaultDescription
idstring | numberRequiredNode unique identifier
titlestringundefinedMain title
thinkTitlestringundefinedCollapse panel title (thinking title)
thinkContentstringundefinedDetailed content displayed when expanded
status'loading' | 'error' | 'success'undefinedNode status identifier (affects icon and color)
isCanExpandbooleanundefinedWhether to allow expanding node content
isDefaultExpandbooleanundefinedWhether to expand node content by default
isMarkdownbooleanundefinedWhether to enable Markdown format rendering
typingTypingConfigundefinedTypewriter effect configuration (same as typewriter component)

Events โ€‹

Event NameParameter TypeDescription
handleExpanditem: ThoughtChainItemProps<T>Triggered when expand state changes

Slots โ€‹

Slot NameScope ParametersDescription
#icon{ item }Custom timeline dot icon

Core Features โ€‹

  1. Multi-state Visualization

    • Supports loading/success/error
    • Automatically switches loading animations, icons, and color feedback
  2. Dynamic Content Management

    • Supports content collapse/expand (configurable default expanded items)
    • Built-in typewriter effect (Typewriter component)
    • Supports Markdown format rendering
  3. Flexible Style Configuration

    • Custom timeline width, dot size
    • Dynamic color gradient lines
    • CSS variable theme override
  4. Responsive Interaction

    • Smooth transition animations
    • Supports dynamic addition/deletion of thinking items
    • Two-way binding of expand state