AI Suggestion Panel
Proactive AI suggestions based on user context and behavior. Features three suggestion types (action, insight, shortcut) with confidence scores, dismissable cards, and a learning footer.
Preview
Default suggestions with all three types
AI Suggestions
Personalized for you
Complete your weekly review
Based on your routine, you usually do this on Fridays at 3pm
Productivity up 23% this week
You completed 12 tasks this week, compared to 9 last week
Quick action available
You frequently check the Marketing Strategy project at this time
Suggestion Types
Three color-coded types for different contexts
Action (Indigo)
AI Suggestions
Personalized for you
Complete weekly review
Based on your routine
Insight (Teal)
AI Suggestions
Personalized for you
Productivity up 23%
You completed more tasks
Shortcut (Amber)
AI Suggestions
Personalized for you
Quick action available
Frequently used project
Custom Suggestions
Provide your own suggestion data
AI Suggestions
Personalized for you
Schedule team meeting
Based on your calendar, Wednesday afternoon is optimal
Sprint velocity increased
Your team completed 15% more story points this sprint
Without Footer
Hide the learning footer for compact layouts
AI Suggestions
Personalized for you
Complete your weekly review
Based on your routine, you usually do this on Fridays at 3pm
Productivity up 23% this week
You completed 12 tasks this week, compared to 9 last week
Quick action available
You frequently check the Marketing Strategy project at this time
Props
AISuggestionPanel component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
suggestions | Suggestion[] | (default suggestions) | Array of suggestions to display |
onAction | (suggestion: Suggestion) => void | — | Callback when action button is clicked |
onDismiss | (suggestionId: string | number) => void | — | Callback when suggestion is dismissed |
onPreferences | () => void | — | Callback when preferences link is clicked |
showFooter | boolean | true | Show the learning footer with preferences link |
className | string | — | Additional CSS classes for the container |
Suggestion Type
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | number | — | Unique suggestion identifier |
type* | 'action' | 'insight' | 'shortcut' | — | Suggestion type (determines color) |
icon | LucideIcon | — | Custom icon (uses type default if not provided) |
title* | string | — | Suggestion title |
description* | string | — | Suggestion description |
confidence* | number | — | Confidence score (0-100) |
action* | string | — | Action button label |
SuggestionType
"action" |"insight" |"shortcut"
Usage
Import and implementation example
import { AISuggestionPanel } from '@/blocks/ai-conversation/ai-suggestion-panel'
import { Target, TrendingUp, Zap } from 'lucide-react'
export default function Example() {
const suggestions = [
{
id: 1,
type: 'action',
icon: Target,
title: 'Complete your weekly review',
description: 'Based on your routine, you usually do this on Fridays',
confidence: 94,
action: 'Start Review',
},
{
id: 2,
type: 'insight',
icon: TrendingUp,
title: 'Productivity up 23%',
description: 'You completed 12 tasks this week',
confidence: 88,
action: 'View Details',
},
{
id: 3,
type: 'shortcut',
icon: Zap,
title: 'Quick action available',
description: 'You frequently check this project',
confidence: 82,
action: 'Open Project',
},
]
const handleAction = (suggestion) => {
console.log('Action clicked:', suggestion)
}
const handleDismiss = (id) => {
console.log('Dismissed:', id)
}
return (
<AISuggestionPanel
suggestions={suggestions}
onAction={handleAction}
onDismiss={handleDismiss}
onPreferences={() => navigate('/settings/ai')}
/>
)
}Features
Built-in functionality
- Three suggestion types: Action (indigo), Insight (teal), and Shortcut (amber)
- Confidence scores: Display match percentage badge for each suggestion
- Contextual actions: Custom action button label per suggestion
- Dismissable cards: Users can dismiss individual suggestions
- Color-coded icons: Type-specific background colors with matching icons
- Learning footer: Optional footer with AI learning message and preferences
- Dynamic counter: Header badge shows count of visible suggestions
- Hover effects: Smooth background transitions on hover
- Gradient header: Indigo-to-teal gradient on wand icon
- Dark mode: Full dark mode support
Accessibility
Accessibility considerations
ARIA Attributes
Action and dismiss buttons are native button elementsPreferences link is a native button elementSuggestions use semantic div structureKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between action and dismiss buttons |
| Enter / Space | Activate the focused button |
Notes
- Confidence badges provide context about suggestion relevance
- Icon colors match type for visual consistency
- Dismissed suggestions are removed from DOM
- Consider adding role="list" for suggestion container
- Consider adding aria-live region for dynamic counter updates