promptCompare
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v119View latest version
A collapsible plan component for displaying AI-generated execution plans with streaming support and shimmer animations.
The Plan component provides a flexible system for displaying AI-generated
execution plans with collapsible content. Perfect for showing multi-step
workflows, task breakdowns, and implementation strategies with support for
streaming content and loading states.
See scripts/plan.tsx for this example.
npx ai-elements@latest add plan
- Collapsible content with smooth animations
- Streaming support with shimmer loading states
- Built on shadcn/ui Card and Collapsible components
- TypeScript support with comprehensive type definitions
- Customizable styling with Tailwind CSS
- Responsive design with mobile-friendly interactions
- Keyboard navigation and accessibility support
- Theme-aware with automatic dark mode support
- Context-based state management for streaming
| Prop | Type | Default | Description |
|---|---|---|---|
isStreaming | boolean | false | Whether content is currently streaming. Enables shimmer animations on title and description. |
defaultOpen | boolean | - | Whether the plan is expanded by default. |
...props | React.ComponentProps<typeof Collapsible> | - | Any other props are spread to the Collapsible component. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.ComponentProps<typeof CardHeader> | - | Any other props are spread to the CardHeader component. |
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | - | The title text. Displays with shimmer animation when isStreaming is true. |
...props | Omit<React.ComponentProps<typeof CardTitle>, | - | Any other props (except children) are spread to the CardTitle component. |
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | - | The description text. Displays with shimmer animation when isStreaming is true. |
...props | Omit<React.ComponentProps<typeof CardDescription>, | - | Any other props (except children) are spread to the CardDescription component. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.ComponentProps<typeof CollapsibleTrigger> | - | Any other props are spread to the CollapsibleTrigger component. Renders as a Button with chevron icon. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.ComponentProps<typeof CardContent> | - | Any other props are spread to the CardContent component. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.ComponentProps< | - | Any other props are spread to the div element. |
| Prop | Type | Default | Description |
|---|---|---|---|
...props | React.ComponentProps<typeof CardAction> | - | Any other props are spread to the CardAction component. |