AI Persona Selector
AI personality selection with pre-configured personas (Assistant, Analyst, Creative, Developer, Teacher, Executive) or custom personas. Each has unique tone, expertise, and communication style.
Preview - Cards Variant
Grid layout with detailed persona cards
Example prompt style
"Help me organize my thoughts about..."
Dropdown Variant
Compact dropdown selector
Pills Variant
Horizontal scrollable pills
Imaginative, inspiring, artistic
Without Custom Option
Hide the create custom persona button
Example prompt style
"Analyze this data and identify key trends..."
2 Column Layout
Wider cards in 2-column grid
Example prompt style
"Explain to me step-by-step how..."
Props
AIPersonaSelector component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
personas | AIPersona[] | — | Array of available personas (uses defaults if not provided) |
value | string | — | Currently selected persona ID |
onChange | (personaId: string) => void | — | Callback when persona changes |
allowCustom | boolean | true | Allow creating custom personas |
onCreateCustom | () => void | — | Callback when user wants to create custom persona |
onEditPersona | (personaId: string) => void | — | Callback when user wants to edit a persona |
showDetails | boolean | true | Show persona details on selection |
variant | 'cards' | 'dropdown' | 'pills' | 'cards' | Display variant |
columns | 2 | 3 | 4 | 3 | Number of columns for cards variant |
className | string | — | Additional CSS classes |
AIPersona Type
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Unique identifier |
name* | string | — | Display name |
description* | string | — | Short description |
icon* | LucideIcon | — | Icon for this persona |
color* | string | — | Color classes |
bgColor* | string | — | Background/gradient classes |
tone | string | — | Tone of communication |
expertise | string[] | — | Expertise areas |
examplePrompt | string | — | Example prompt style |
isCustom | boolean | — | Is this a custom/user-created persona |
avatarUrl | string | — | Preview avatar or image URL |
Usage
Import and implementation example
import { AIPersonaSelector } from '@/blocks/ai-transparency/ai-persona-selector'import { useState } from 'react'
export default function Example() { const [persona, setPersona] = useState('assistant')
return ( <AIPersonaSelector value={persona} onChange={(id) => { setPersona(id) // Update AI behavior based on selected persona console.log('Selected persona:', id) }} variant="cards" columns={3} showDetails={true} allowCustom={true} onCreateCustom={() => { console.log('Create custom persona') }} /> )}Features
Built-in functionality
- Six default personas: Assistant, Analyst, Creative, Developer, Teacher, Executive
- Three display variants: Cards, dropdown, or horizontal pills
- Flexible columns: 2, 3, or 4 column grid for cards variant
- Custom personas: Allow users to create and edit custom personas
- Expertise tags: Show expertise areas for each persona
- Example prompts: Display example prompt style for selected persona
- Tone indicators: Each persona has defined communication tone
- Visual selection: Clear selected state with checkmarks
- Dark mode support: Full dark mode with proper contrast
Default Personas
Built-in persona configurations
General Assistant
Helpful, balanced, and adaptable
Tone: Friendly and professional
Data Analyst
Precise, analytical, data-focused
Tone: Analytical and thorough
Creative Partner
Imaginative, inspiring, artistic
Tone: Enthusiastic and imaginative
Code Expert
Technical, precise, solution-oriented
Tone: Technical and concise
Patient Teacher
Educational, clear, encouraging
Tone: Patient and encouraging
Business Advisor
Strategic, efficient, results-driven
Tone: Professional and strategic
Accessibility
ARIA support and keyboard navigation
ARIA Attributes
Persona cards are interactive buttonsSelected state indicated with checkmark iconDropdown has proper ARIA controlsKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate between personas |
| Enter / Space | Select persona |
| Arrow Up/Down | Navigate dropdown options |
| Escape | Close dropdown |
Notes
- Selected persona should be announced to screen readers
- Expertise tags provide additional context
- Icons help with visual recognition
- Example prompts demonstrate persona style