Chat Input Components
The chat input system consists of several key components that handle user input, mentions, and context management.
ContextBadgeRow
TheContextBadgeRow
component displays selected context items (like mentions, state, or custom context) as badges above the input field. Users can click these badges to remove them from the context.
- Displays context entries as removable badges
- Shows icons and colors from mention providers
- Handles removal of mentions from both context and editor
- Supports custom rendering through mention providers
- Automatically renders badges for all registered mention types
editor
- The Tiptap editor instance for mention removal
Editor Section (Tiptap Integration)
Cedar uses Tiptap as the rich text editor for chat input. This provides powerful text editing capabilities with support for mentions, formatting, and extensibility.- Rich text editing with markdown support
- Mention system integration (@, #, / triggers)
- Keyboard shortcuts and navigation
- Multi-line input support
- Extensible through Tiptap extensions
- Document, Paragraph, Text (core)
- HardBreak for line breaks
- Mention extension for @mentions
- History for undo/redo
- Placeholder support
MentionList
TheMentionList
component renders the dropdown menu that appears when users type mention triggers (like @ or #). It displays available mention options with custom rendering support.
- Keyboard navigation (arrow keys, enter)
- Custom rendering through mention providers
- Color theming based on mention metadata
- Hover and selection states
- Provider-specific item rendering
items
- Array ofMentionItem
objects to displaycommand
- Function called when an item is selected
Message Components
Message components handle the display and rendering of chat messages in different formats and layouts.ChatRenderer
TheChatRenderer
is the core component responsible for rendering individual messages based on their type. It supports both built-in message types and custom message renderers.
text
- Standard text messages with markdown supportdialogue_options
- Interactive option buttonsmultiple_choice
- Choice buttons with keyboard shortcutstodolist
- Interactive todo list itemsticker
- Horizontal scrolling content cardsslider
- Slider input for numeric values
- Automatic message type detection
- Custom renderer registration support
- Markdown rendering with code block support
- Consistent styling across message types
- Dark/light mode support
ChatBubbles
TheChatBubbles
component manages the scrollable message container with animations and auto-scrolling behavior.
- Auto-scroll to latest messages
- Smooth animations for new messages
- Typing indicator support
- Consecutive message grouping
- Custom height and styling options
- Optimized scrolling performance
maxHeight
- Maximum height (e.g., “300px”, “60vh”)className
- Additional CSS classes
CaptionMessages
TheCaptionMessages
component is specialized for caption-style chat interfaces, showing only the latest message with enhanced typography and interactions.
- Shows only the latest relevant message
- Enhanced typography with typewriter effects
- Shimmer text for thinking states
- Interactive elements (buttons, sliders)
- Keyboard shortcut integration
- Optimized for overlay/caption use cases
showThinking
- Whether to show user messages and thinking states
text
- Typewriter animation with “Cedar:” prefixdialogue_options
- 3D button grid with hover effectsticker
- Horizontal scrolling with “Next Step” buttonmultiple_choice
- Inline choice buttons with shortcutsslider
- Interactive 3D slider component
Container Components
Container components provide the structural layout and positioning for different chat interface styles.FloatingContainer
TheFloatingContainer
provides a floating, resizable chat window that can be positioned at different screen locations.
- Multiple positioning options (bottom-left, bottom-right, bottom-center)
- Resizable with drag handles (corner positions only)
- Smooth animations with spring physics
- Responsive design with mobile adaptations
- Constraint-based resizing with min/max limits
isActive
- Whether the container is visibleposition
- Screen position (‘bottom-left’ | ‘bottom-right’ | ‘bottom-center’)dimensions
- Size configuration objectresizable
- Enable/disable resize functionalityonResize
- Callback for size changesclassName
- Additional CSS classes
SidePanelContainer
TheSidePanelContainer
creates a side panel that pushes the main content to make room for the chat interface.
- Left or right side positioning
- Content area automatically adjusts padding
- Resizable with drag handle
- Mobile-responsive (full screen on mobile)
- Top offset support for fixed headers
- Smooth slide animations
isActive
- Whether the panel is openside
- Panel position (‘left’ | ‘right’)panelContent
- React node to render in the paneldimensions
- Width configuration objectresizable
- Enable/disable resize functionalitytopOffset
- Top spacing in pixels (for fixed headers)onResize
- Callback for width changesclassName
- Additional CSS classes for main contentpanelClassName
- Additional CSS classes for panel
Component Integration
These components work together to create the complete chat experience:- Input Flow:
ContextBadgeRow
→ Tiptap Editor →MentionList
- Message Flow:
ChatRenderer
→ChatBubbles
orCaptionMessages
- Layout Flow:
FloatingContainer
orSidePanelContainer
wraps the entire chat
Next Steps
- Explore Custom Message Rendering to create your own message types
- Learn about Mentions to add contextual references
- Check out Streaming for real-time message updates