Skip to content

Thinking Component ๐Ÿ“ โ€‹

Introduction โ€‹

Thinking is a component used to display thinking states, supporting state management, content expand/collapse, and custom styling. Through visual feedback of different states (start/thinking/end/error), it helps users intuitively understand AI's thinking process. The component has built-in transition animations and provides flexible extension slots, suitable for use in intelligent conversations, data analysis, and other scenarios.

๐Ÿ’Œ Info

This component can be used together with components like BubbleList to achieve richer interactive experiences.

Code Examples โ€‹

Basic Usage โ€‹

Most basic integration method

Content Expand/Collapse โ€‹

Welcome to Element-Plus-X

Content display can be set through the content attribute

State Management โ€‹

Welcome to Element-Plus-X

Through the v-model attribute, we can set the default state.

State Styles โ€‹

Set the component state through the status attribute. There are four default states: start, thinking, end, error

Auto Collapse โ€‹

Welcome to Element-Plus-X

Auto collapse attribute. When the component status state changes to end, it automatically collapses. This attribute defaults to false.

Disabled State โ€‹

Disable operations

Width Customization โ€‹

Welcome to Element-Plus-X

The buttonWidth and maxWidth attributes can set the maximum width of the expand/collapse button and expanded content. Both are string type, meaning you can use units like px, %, vw, vh, etc.

Content Color Style Customization โ€‹

Welcome to Element-Plus-X ๐Ÿ‰๐Ÿ‰๐Ÿ‰

Quickly set the background color and font color of the content area through color and backgroundColor. Type is string, meaning you can use CSS color values.

Slot Customization โ€‹

: Welcome to Element-Plus-X

The component provides multiple custom slots for developers to customize component styles

  • #status-icon: Status icon slot
  • #label: Status text slot
  • #arrow: Arrow slot
  • #content: Content slot
  • #error: Error message slot

Attributes โ€‹

AttributeTypeRequiredDefaultDescription
contentStringNo''Main content text to display, no typing effect, determined by interface response
modelValueBooleanNotrueExpand state bound through v-model, default is expanded
statusThinkingStatusNo'start'Component state: start (start) / thinking (thinking) / end (complete) / error (error)
autoCollapseBooleanNofalseWhether to automatically collapse content area when component state changes to end
disabledBooleanNofalseWhether to disable component interaction
buttonWidthStringNo'160px'Trigger button width
durationStringNo'0.2s'Transition animation duration
maxWidthStringNo'500px'Maximum width of content area
backgroundColorStringNo'#fcfcfc'Background color of content area
colorStringNo'var(--el-color-info)'Content text color

Events โ€‹

Event NameParametersTypeDescription
@change{value:boolean,status:ThinkingStatus}FunctionTriggered when expand state or status changes

Slots โ€‹

Slot NameParametersTypeDescription
#status-icon{ status }SlotCustom status icon
#label{ status }SlotCustom button text
#arrow-SlotCustom arrow icon
#content{ content }SlotCustom content area (non-error state)
#error-SlotCustom error message content display

Features โ€‹

  1. Multi-state Management

    • Supports four states: start/thinking/end/error, automatically switches corresponding icons and text
    • Forces display of fixed error prompt in error state
  2. Interactive Feedback

    • Smooth sliding animation when expanding/collapsing content area
    • Button click feedback supports custom transition effects
  3. Style Customization

    • Controls visual properties such as size and color through CSS variables
    • Provides complete slot extension capabilities, supports custom icons and content
  4. Smart Behavior

    • Automatically adjusts expand state when status changes
    • Maintains visual feedback but blocks interaction in disabled state