+
diff --git a/packages/elements/src/message/MessageContent.vue b/packages/elements/src/message/MessageContent.vue
index 1e4d4d8..8f9f5ef 100644
--- a/packages/elements/src/message/MessageContent.vue
+++ b/packages/elements/src/message/MessageContent.vue
@@ -8,7 +8,7 @@ interface Props {
const props = defineProps
()
const classes = computed(() => [
- 'flex flex-col gap-2 overflow-hidden rounded-lg px-4 py-3 text-foreground text-sm',
+ 'max-w-[80%] flex flex-col gap-2 overflow-hidden rounded-lg px-4 py-3 text-foreground text-sm',
'group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground',
'group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground',
'is-user:dark',
diff --git a/packages/examples/src/actions-hover.vue b/packages/examples/src/actions-hover.vue
new file mode 100644
index 0000000..eed6452
--- /dev/null
+++ b/packages/examples/src/actions-hover.vue
@@ -0,0 +1,49 @@
+
+
+
+
+ {{ responseContent }}
+
+
+
+
+
+
+
diff --git a/packages/examples/src/actions.vue b/packages/examples/src/actions.vue
new file mode 100644
index 0000000..89a2e07
--- /dev/null
+++ b/packages/examples/src/actions.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+ {{ message.content }}
+
+
+
+
+
+
+
+
+
diff --git a/packages/examples/src/index.ts b/packages/examples/src/index.ts
index 520fe96..0d952fd 100644
--- a/packages/examples/src/index.ts
+++ b/packages/examples/src/index.ts
@@ -1,3 +1,5 @@
+export { default as ActionsHover } from './actions-hover.vue'
+export { default as Actions } from './actions.vue'
export { default as Conversation } from './conversation.vue'
export { default as MessageMarkdown } from './message-markdown.vue'
export { default as Message } from './message.vue'
From e073bd828ed5643e622c94ee68ca519f9ded9f7e Mon Sep 17 00:00:00 2001
From: cwandev <18888351756@163.com>
Date: Mon, 22 Sep 2025 15:15:07 +0800
Subject: [PATCH 2/2] docs: add actions component documentation
---
README.md | 2 +-
apps/www/content/1.overview/1.Introduction.md | 3 +
apps/www/content/2.components/5.actions.md | 283 ++++++++++++++++++
apps/www/plugins/ai-elements.ts | 4 +
package.json | 2 +-
packages/elements/package.json | 2 +-
packages/registry/README.md | 2 +-
pnpm-lock.yaml | 2 +-
8 files changed, 295 insertions(+), 5 deletions(-)
create mode 100644 apps/www/content/2.components/5.actions.md
diff --git a/README.md b/README.md
index bac975a..f083c1a 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ AI Elements Vue includes the following components:
| `conversation` | ✅ 已完成 | Container for chat conversations |
| `response` | ✅ 已完成 | Formatted AI response display |
| `prompt-input` | ✅ 已完成 | Advanced input component with model selection |
-| `actions` | ❌ 未完成 | Interactive action buttons for AI responses |
+| `actions` | ✅ 已完成 | Interactive action buttons for AI responses |
| `branch` | ❌ 未完成 | Branch visualization for conversation flows |
| `code-block` | ❌ 未完成 | Syntax-highlighted code display with copy functionality |
| `image` | ❌ 未完成 | AI-generated image display component |
diff --git a/apps/www/content/1.overview/1.Introduction.md b/apps/www/content/1.overview/1.Introduction.md
index b52d343..71b36f0 100644
--- a/apps/www/content/1.overview/1.Introduction.md
+++ b/apps/www/content/1.overview/1.Introduction.md
@@ -24,4 +24,7 @@ You can install it with:
:::ComponentLoader{label="Response" componentName="Response"}
:::
+:::ComponentLoader{label="Actions" componentName="Actions"}
+:::
+
View the [source code](https://github.com/cwandev/ai-elements-vue) for all components on GitHub.
diff --git a/apps/www/content/2.components/5.actions.md b/apps/www/content/2.components/5.actions.md
new file mode 100644
index 0000000..8fa5ab5
--- /dev/null
+++ b/apps/www/content/2.components/5.actions.md
@@ -0,0 +1,283 @@
+---
+title: Actions
+description:
+icon: lucide:message-square-more
+---
+
+The `Actions` component provides a flexible row of action buttons for AI responses with common actions like retry, like, dislike, copy, and share.
+
+:::ComponentLoader{label="Actions" componentName="Actions"}
+:::
+
+## Install using CLI
+
+::tabs{variant="card"}
+ ::div{label="ai-elements-vue"}
+ ```sh
+ npx ai-elements-vue@latest add actions
+ ```
+ ::
+ ::div{label="shadcn-vue"}
+
+ ```sh
+ npx shadcn-vue@latest add https://registry.ai-elements-vue.com/actions.json
+ ```
+ ::
+::
+
+## Install Manually
+
+Copy and paste the following code in the same folder.
+
+::code-group
+ ```vue [Actions.vue]
+
+
+
+
+
+
+
+ ```
+
+ ```vue [Action.vue]
+
+
+
+
+
+
+
+
+ {{ props.label || props.tooltip }}
+
+
+
+ {{ props.tooltip }}
+
+
+
+
+
+
+ {{ props.label || props.tooltip }}
+
+
+ ```
+
+ ```ts [index.ts]
+ export { default as Action } from './Action.vue'
+ export { default as Actions } from './Actions.vue'
+ ```
+::
+
+## Usage
+
+```vue
+
+
+
+
+
+
+
+
+
+```
+
+## Usage with AI SDK
+
+Build a simple chat UI where the user can copy or regenerate the most recent message.
+
+Add the following component to your frontend:
+
+```vue filename="app/page.vue"
+
+
+
+
+
+
+
+
+
+ {{ message.content }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+## Features
+
+- Row of composable action buttons with consistent styling
+- Support for custom actions with tooltips
+- State management for toggle actions (like, dislike, favorite)
+- Keyboard accessible with proper ARIA labels
+- Clipboard and Web Share API integration
+- TypeScript support with proper type definitions
+- Consistent with design system styling
+
+## Examples
+
+:::ComponentLoader{label="ActionsHover" componentName="ActionsHover"}
+:::
+
+## Props
+
+### ` `
+
+::field-group
+ ::field{name="class" type="string"}
+ Additional classes applied to the root element.
+ ::
+::
+
+### ` `
+
+::field-group
+ ::field{name="tooltip" type="string"}
+ Optional tooltip text shown on hover.
+ ::
+
+ ::field{name="label" type="string"}
+ Accessible label for screen readers. Also used as fallback if tooltip is not provided.
+ ::
+
+ ::field{name="variant" type="'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link'"}
+ The visual style variant of the button. Defaults to 'ghost'.
+ ::
+
+ ::field{name="size" type="'default' | 'sm' | 'lg' | 'icon'"}
+ The size of the button. Defaults to 'sm'.
+ ::
+
+ ::field{name="class" type="string"}
+ Additional classes applied to the button element.
+ ::
+::
diff --git a/apps/www/plugins/ai-elements.ts b/apps/www/plugins/ai-elements.ts
index 04cd32a..24e31ec 100644
--- a/apps/www/plugins/ai-elements.ts
+++ b/apps/www/plugins/ai-elements.ts
@@ -1,4 +1,6 @@
import {
+ Actions,
+ ActionsHover,
Conversation,
Message,
MessageMarkdown,
@@ -15,6 +17,8 @@ export default defineNuxtPlugin((nuxtApp) => {
vueApp.component('ComponentLoader', ComponentLoader)
vueApp.component('ComponentViewer', ComponentViewer)
+ vueApp.component('Actions', Actions)
+ vueApp.component('ActionsHover', ActionsHover)
vueApp.component('Message', Message)
vueApp.component('MessageMarkdown', MessageMarkdown)
vueApp.component('PromptInput', PromptInput)
diff --git a/package.json b/package.json
index 87a2939..92a2f93 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "ai-elements-vue",
"version": "0.1.1",
"private": true,
- "packageManager": "pnpm@10.15.1",
+ "packageManager": "pnpm@10.17.0",
"engines": {
"node": ">=20.19.0"
},
diff --git a/packages/elements/package.json b/packages/elements/package.json
index 9c802e0..a2c56bf 100644
--- a/packages/elements/package.json
+++ b/packages/elements/package.json
@@ -8,7 +8,7 @@
},
"dependencies": {
"@repo/shadcn-vue": "workspace:*",
- "ai": "^5.0.28",
+ "ai": "^5.0.29",
"lucide-vue-next": "^0.542.0",
"streamdown-vue": "^1.0.20",
"vue": "^3.5.20",
diff --git a/packages/registry/README.md b/packages/registry/README.md
index 420be04..5e3c30c 100644
--- a/packages/registry/README.md
+++ b/packages/registry/README.md
@@ -84,7 +84,7 @@ AI Elements Vue includes the following components:
| `conversation` | ✅ 已完成 | Container for chat conversations |
| `response` | ✅ 已完成 | Formatted AI response display |
| `prompt-input` | ✅ 已完成 | Advanced input component with model selection |
-| `actions` | ❌ 未完成 | Interactive action buttons for AI responses |
+| `actions` | ✅ 已完成 | Interactive action buttons for AI responses |
| `branch` | ❌ 未完成 | Branch visualization for conversation flows |
| `code-block` | ❌ 未完成 | Syntax-highlighted code display with copy functionality |
| `image` | ❌ 未完成 | AI-generated image display component |
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 51c3147..7c55577 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -146,7 +146,7 @@ importers:
specifier: workspace:*
version: link:../shadcn-vue
ai:
- specifier: ^5.0.28
+ specifier: ^5.0.29
version: 5.0.39(zod@4.1.5)
lucide-vue-next:
specifier: ^0.542.0