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 โ
Content Expand/Collapse โ
Welcome to Element-Plus-X
State Management โ
Welcome to Element-Plus-X
State Styles โ
Auto Collapse โ
Welcome to Element-Plus-X
Disabled State โ
Width Customization โ
Welcome to Element-Plus-X
Content Color Style Customization โ
Welcome to Element-Plus-X ๐๐๐
Slot Customization โ
: Welcome to Element-Plus-X
Attributes โ
Attribute | Type | Required | Default | Description |
---|---|---|---|---|
content | String | No | '' | Main content text to display, no typing effect, determined by interface response |
modelValue | Boolean | No | true | Expand state bound through v-model, default is expanded |
status | ThinkingStatus | No | 'start' | Component state: start (start) / thinking (thinking) / end (complete) / error (error) |
autoCollapse | Boolean | No | false | Whether to automatically collapse content area when component state changes to end |
disabled | Boolean | No | false | Whether to disable component interaction |
buttonWidth | String | No | '160px' | Trigger button width |
duration | String | No | '0.2s' | Transition animation duration |
maxWidth | String | No | '500px' | Maximum width of content area |
backgroundColor | String | No | '#fcfcfc' | Background color of content area |
color | String | No | 'var(--el-color-info)' | Content text color |
Events โ
Event Name | Parameters | Type | Description |
---|---|---|---|
@change | {value:boolean,status:ThinkingStatus} | Function | Triggered when expand state or status changes |
Slots โ
Slot Name | Parameters | Type | Description |
---|---|---|---|
#status-icon | { status } | Slot | Custom status icon |
#label | { status } | Slot | Custom button text |
#arrow | - | Slot | Custom arrow icon |
#content | { content } | Slot | Custom content area (non-error state) |
#error | - | Slot | Custom error message content display |
Features โ
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
- Supports four states:
Interactive Feedback
- Smooth sliding animation when expanding/collapsing content area
- Button click feedback supports custom transition effects
Style Customization
- Controls visual properties such as size and color through CSS variables
- Provides complete slot extension capabilities, supports custom icons and content
Smart Behavior
- Automatically adjusts expand state when status changes
- Maintains visual feedback but blocks interaction in disabled state