React Components
Coming soon: Pre-built React components
Coming Soon: Pre-built React components for EasyRAG
We're building a library of ready-to-use React components that handle all the complexity of file uploads, search, and chat interfaces.
Here's what the components will look like:
bashnpm install @easyrag/react # or yarn add @easyrag/react
jsximport { FileUpload } from '@easyrag/react'; function MyApp() { return ( <FileUpload datasetId="my-dataset" token={frontendToken} onUploadComplete={(files) => { console.log('Uploaded:', files); }} onError={(error) => { console.error('Upload failed:', error); }} accept={['.pdf', '.docx']} maxSize={100 * 1024 * 1024} /> ); }
jsximport { ChatInterface } from '@easyrag/react'; function MyApp() { return ( <ChatInterface datasetId="support-docs" token={frontendToken} placeholder="Ask a question about our products..." welcomeMessage="Hi! How can I help you today?" streaming={true} /> ); }
jsximport { SearchBox } from '@easyrag/react'; function MyApp() { return ( <SearchBox datasetId="company-docs" token={frontendToken} onResultsChange={(results) => { console.log('Found:', results); }} filters={[ { key: 'department', match: { value: 'legal' } } ]} /> ); }
jsximport { FileManager } from '@easyrag/react'; function MyApp() { return ( <FileManager datasetId="user-documents" token={frontendToken} allowDelete={true} allowPreview={true} onFileClick={(file) => { console.log('Clicked:', file.originalName); }} /> ); }
All components support:
jsx<ChatInterface className="my-custom-chat" theme={{ primaryColor: '#4f46e5', fontFamily: 'Inter, sans-serif', borderRadius: '12px' }} />
jsx<ChatInterface renderMessage={(message) => ( <CustomMessageBubble {...message} /> )} renderInput={(props) => ( <CustomInput {...props} /> )} />
jsximport { useFileUpload, useChat, useSearch } from '@easyrag/react'; function CustomChatUI() { const { messages, sendMessage, loading, error } = useChat({ datasetId: 'my-dataset', token: frontendToken }); // Build your own UI return ( <div> {messages.map(msg => <div>{msg.content}</div>)} <button onClick={() => sendMessage('Hello')}> Send </button> </div> ); }
Full TypeScript definitions included:
typescriptimport type { FileUploadProps, ChatInterfaceProps, Message, UploadProgress } from '@easyrag/react'; const config: ChatInterfaceProps = { datasetId: 'my-dataset', token: frontendToken, streaming: true, onMessage: (message: Message) => { console.log(message.content); } };
Want early access to the React components?
š§ Email: support@easyrag.com with "React Components Beta" in the subject
Once released, we'll provide a full examples repository with:
Build your own components using:
Help us build the components you need! Share your requirements:
Estimated Release: Q1 2025
Status: In active development
License: MIT (open source)