AI Right Sidebar

AI
Layout
Block

Collapsible right sidebar for AI chat interfaces with multi-tab navigation. Features chat, context management, conversation history, and settings panels in a Perplexity Comet-style design.

Preview

Full-featured sidebar with all tabs

Main Content Area

This area represents your main application content. The sidebar on the right provides AI assistance without blocking the main view.

Non-modal: Content adjusts when sidebar opens/closes.

Multi-section: Chat, Context, History, and Settings tabs.

AI Assistant

Hi! I can help you with information about the current context. What would you like to know?

10:32 AM

Width Variants

Three width presets: narrow, medium, wide

Narrow (280px)

AI Assistant

Hi! I can help you with information about the current context. What would you like to know?

10:32 AM

Medium (360px)

AI Assistant

Hi! I can help you with information about the current context. What would you like to know?

10:32 AM

Wide (480px)

AI Assistant

Hi! I can help you with information about the current context. What would you like to know?

10:32 AM

Custom Resources

Provide your own context resources

AI Assistant

Active Resources

Props

AIRightSidebar component API reference

PropTypeDefaultDescription
isOpenbooleantrueWhether the sidebar is open
onToggle() => voidCallback when the sidebar is toggled
width'narrow' | 'medium' | 'wide''medium'Sidebar width preset (280px, 360px, 480px)
resizablebooleantrueEnable drag-to-resize functionality
pinnablebooleantrueShow pin button in header
sectionsSidebarSection[]['chat', 'context', 'history', 'settings']Available tab sections to display
defaultActiveTabSidebarSection'chat'Initial active tab
defaultPinnedbooleanfalseInitial pinned state
messagesMessage[](default messages)Chat messages to display
resourcesResource[](default resources)Context resources to display
historyItemsHistoryItem[](default items)History items to display
onSend(message: string) => voidCallback when a message is sent
onResourceToggle(resourceId: string) => voidCallback when a resource is toggled
onHistorySelect(item: HistoryItem) => voidCallback when a history item is clicked
classNamestringAdditional CSS classes for the container

Resource Type

PropTypeDefaultDescription
id*stringUnique resource identifier
icon*LucideIconIcon component to display
label*stringResource label
description*stringResource description
active*booleanWhether resource is active

Message Type

PropTypeDefaultDescription
id*string | numberUnique message identifier
role*'assistant' | 'user'Message sender role
content*stringMessage content
time*stringMessage timestamp

Usage

Import and implementation example

import { AIRightSidebar } from '@/blocks/ai-tools/ai-right-sidebar'
import { Globe, Brain, Upload } from 'lucide-react'

export default function Example() {
  const [isOpen, setIsOpen] = useState(true)

  const resources = [
    { id: 'web', icon: Globe, label: 'Web Search', description: 'Search the internet', active: true },
    { id: 'kb', icon: Brain, label: 'Knowledge Base', description: 'Company docs', active: false },
    { id: 'files', icon: Upload, label: 'Files', description: '3 files attached', active: true },
  ]

  const handleSend = (message: string) => {
    console.log('Sending:', message)
  }

  return (
    <div className="flex h-screen">
      <main className="flex-1">
        {/* Your main content */}
      </main>

      <AIRightSidebar
        isOpen={isOpen}
        onToggle={() => setIsOpen(!isOpen)}
        width="medium"
        resources={resources}
        onSend={handleSend}
        onResourceToggle={(id) => console.log('Toggle:', id)}
      />
    </div>
  )
}

Built With

1 component

This block uses the following UI components from the design system:

Features

Built-in functionality

  • Non-modal design: Sidebar adjusts content width, never overlays
  • Multi-section tabs: Chat, Context, History, and Settings in one interface
  • Width presets: Narrow (280px), medium (360px), and wide (480px) options
  • Pinnable: Pin button to keep sidebar always open
  • Context management: Toggle active resources like web search and knowledge base
  • Chat interface: Built-in message display and input with send button
  • Conversation history: Access previous conversations with timestamps
  • Settings panel: Model selection and temperature controls
  • Smooth transitions: Animated tab switching and hover states
  • Dark mode: Full dark mode support with proper gradients

Accessibility

Accessibility considerations

ARIA Attributes

Tab buttons are native button elementsChat input is a native input elementPin and close buttons have visual indicators

Keyboard Navigation

KeyAction
TabNavigate between tabs, input, and action buttons
EnterSend message when input is focused
Enter / SpaceActivate focused tab or button

Notes

  • Active tab has visible border and background highlight
  • Pinned state shows with indigo background on pin button
  • Resource active state indicated with indigo background
  • Consider adding aria-selected to tab buttons
  • Consider adding role="tablist" and role="tabpanel"