1. [Project Overview](#project-overview) 2. [Installation](#installation) 3. [Available Components](#available-citations) - [Citation Components](#citation-components) - [BookCitation](#bookcitation) [<img src="https://github.githubassets.com/ima
npm install @e-llm-studio/citation1. Project Overview
2. Installation
3. Available Components
- Citation Components
- BookCitation ![]()
- ChatCitation ![]()
- CitationRenderer ![]()
- CognitiveDecisioningCard ![]()
- CognitiveInternalGPTReasoning ![]()
- CodeCitation ![]()
- CitationsViewer ![]()
- PdfEditorCitation ![]()
- RequirementAICitation ![]()
- Other Components
- Bookemon ![]()
- DatagestMon ![]()
- DataSelector![]()
- PaginatedTable ![]()
- PdfViewer ![]()
- ProjectAccordion ![]()
- UploadData ![]()
4. Common Use Cases
5. Development & Contribution
6. License
The @e-llm-studio/citation library is a comprehensive React component library designed to render various types of citations and related UI elements within the e-LLM Studio ecosystem. It provides a robust set of reusable, production-ready components that enable developers to display citations, reasoning chains, code snippets, PDFs, and other content types with rich interactive features and highly customizable styling.
This library serves as a foundational building block for applications that need to present complex information in an organized, user-friendly manner. Whether you're displaying book citations with highlighted passages, rendering AI reasoning with confidence scores, showcasing code with syntax highlighting, or managing large datasets with pagination, the citation library offers flexible, well-documented components that integrate seamlessly into modern React applications.
The library emphasizes developer experience through comprehensive documentation, TypeScript support, and extensive customization options. Each component is designed with accessibility and performance in mind, ensuring that applications built with these components provide excellent user experiences across different devices and use cases.
---
Before you begin, ensure you have the following installed on your system:
- Node.js & npm - Required for package management and running build scripts
- Git - Required for cloning the repository
- Basic familiarity with Git and the command line
#### 1. Clone the Repository
Start by cloning the citation library repository to your local machine:
``bash
git clone https://github.com/e-llm-studio/citation.git
cd citation
`
#### 2. Install Dependencies
Install all required dependencies using npm:
`bash`
npm install
Alternatively, you can use yarn if you prefer:
`bash`
yarn install
#### 3. Link the Library Locally (Optional)
If you want to test the library in another project before publishing, you can link it locally:
`bashIn the citation library folder
npm link
This allows you to test changes in your local library without publishing to npm.
#### 4. Build the Library
Build the library to compile TypeScript and prepare distribution files:
`bash
npm run build
`#### 5. Test Locally
After building, you can test the library in your project:
`bash
In your test project
npm start
or
npm run build
`Import the library components and verify that your changes work as expected.
$3
If you're installing the published package from npm:
`bash
Using npm
npm install @e-llm-studio/citationUsing yarn
yarn add @e-llm-studio/citationUsing pnpm
pnpm add @e-llm-studio/citation
`---
Citation Components
BookCitation
$3
The BookCitation component is designed to display book citations with an interactive and expandable interface. It provides a rich, user-friendly way to present quoted text from books with support for highlighting, citation details management, and book cover images. The component enables readers to explore citations in context while maintaining a clean, organized presentation.
$3
- Text highlighting with partial and full match support - Highlights specific text passages within citations using flexible matching algorithms
- Automatic cleaning of scanned text to remove artifacts - Intelligently removes OCR artifacts, page numbers, headers, and footers
- Expandable/collapsible view of citation details - Toggle between collapsed citation button and expanded view
- Blur effect for non-highlighted text - Applies visual blur to non-highlighted portions to focus reader attention
- Scroll-to-highlight functionality - Automatically scrolls to and centers highlighted text when expanded
- Support for book cover images and external links - Displays book cover images and provides clickable external links
- Customizable styling through the customStyle prop - Allows fine-grained control over component appearance
$3
`tsx
import BookCitation from '@e-llm-studio/citation/BookCitation' citationTitle="Sample Book"
paragraphs={['
Highlighted text example
']}
textToHighlight={['example']}
partialMatch={true}
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
title | string | Optional title of the book or publication being cited |
| author | string \| string[] | Optional author name(s) of the book or publication |
| pageNumber | string | Optional current page number where the citation is located |
| totalPageNumber | string | Optional total number of pages in the book or publication |
| paragraphs | string[] | Required array of HTML strings containing the text content |
| citationTitle | string | Required title or label for the citation |
| textToHighlight | string[] | Required array of text strings to highlight within the paragraphs |
| bookCoverImage | string | Optional URL or path to the book cover image |
| handleExternalLinkClick | () => void | Optional callback function triggered when external link is clicked |
| externalLinkComponent | React.ReactNode | Optional React component to render as an external link button |
| citationNumber | number | Optional citation number displayed in the citation button |
| partialMatch | boolean | Optional flag to enable partial text matching when highlighting |
| defaultState | boolean | Optional flag to set the initial expanded/collapsed state |
| isNonHighlightedBlur | boolean | Optional flag to enable blur effect on non-highlighted text |
| customStyle | object | Optional object for overriding default styles |---
ChatCitation
$3
ChatCitation is a composable React UI component for rendering chat-based citations, including summarized and detailed chat views alongside a rule book/reference section. The component is designed to be highly customizable via renderers, slot styles, and slot props, making it flexible for various use cases.
$3
- Composable chat views - Supports both summarized and detailed chat display modes
- Rule book/reference section - Optional left panel for displaying supporting rules and references
- Markdown rendering - Rich text support with customizable markdown renderers
- Customizable styling - Fine-grained control over styles through slot-based customization
- Relevance scoring - Display AI relevance scores for citations
- Tab-based navigation - Toggle between summarized and detailed views
- Flexible content rendering - Support for custom renderers and markdown components
$3
`tsx
import ChatCitation from '@e-llm-studio/citation/ChatCitation' chatContainer={{
chatData: [
{ role: 'user', message: 'Hello', userName: 'User1', timeStamp: dayjs() }
]
}}
ruleBookContainer={{
title: 'References',
data: { content: 'Rule content', highlighted_texts: ['important'] }
}}
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
rootContainer | RootContainerProps | Optional top-level container configuration |
| chatContainer | ChatContainerProps | Required chat container configuration with chat data |
| ruleBookContainer | RuleBookContainerProps | Optional rule book/reference section configuration |
| renderer | FeatureModMarkdownProps["renderers"] | Optional custom markdown renderers |---
CitationRenderer
$3
CitationRenderer is a versatile, interactive "Pill" component designed to display a compact reference citation that expands into detailed content. It provides a space-efficient toggle mechanism, perfect for displaying source material, footnotes, or reasoning chains without cluttering the main UI. It works seamlessly with MarkdownRenderer to display rich, interactive text content.
$3
- Expandable pill button - Compact display that expands on click
- Customizable icons - Support for custom icons for chevron and citation indicators
- Markdown content support - Render rich text content using MarkdownRenderer
- Controlled and uncontrolled modes - Manage state internally or externally
- Flexible styling - Customize appearance through style props
- Callback support - Optional callbacks for side effects on toggle
$3
`tsx
import CitationRenderer from '@e-llm-studio/citation/CitationRenderer' inLineCitation={true}
citationTitle="Reference 1"
citationComponent={
Detailed content here}
chevronDownComponent={ }
chevronUpComponent={ }
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
inLineCitation | boolean | Must be true to enable expand/collapse behavior |
| citationTitle | string | The text displayed inside the pill button |
| citationComponent | ReactNode | The content to render when expanded |
| citationIcon | ReactNode | Icon displayed to the left of the title |
| chevronUpComponent | ReactNode | Icon shown when the citation is expanded |
| chevronDownComponent | ReactNode | Icon shown when the citation is collapsed |
| additionalCallbackForPillButton | func | Hook to trigger side effects on click |
| styles | Object | CSS overrides for styling |
| isOpen | boolean | Forces the expanded state (controlled mode) |
| onToggle | func | Callback fired when the pill is clicked |---
CognitiveDecisioningCard
$3
CognitiveDecisioningCard is a specialized React UI component designed to provide transparency into AI workflows. It renders a toggleable "Pill" that expands into a detailed card, displaying the AI's Reasoning, identified Gaps, and a confidence Score. It features a nested accordion design, robust Markdown rendering for content, and full styling customization.
$3
- Toggleable pill button - Click to expand/collapse the detailed card
- Reasoning and gap sections - Display AI reasoning and identified gaps with markdown support
- Confidence score badge - Show confidence percentage in the header
- Nested accordion design - Collapsible sections for organized content
- Custom markdown rendering - Support for custom markdown components
- Icon customization - Replace default icons with custom components
- Advanced section customization - Override default sections with custom data structures
$3
`tsx
import CognitiveDecisioningCard from '@e-llm-studio/citation/CognitiveDecisioningCard' isOpen={isOpen}
onToggle={() => setIsOpen(!isOpen)}
score="92"
reasoning="Analysis: Based on document review..."
gap="Missing date information in section 3."
title="AI Analysis Report"
/>
`Advanced Customization:
`tsx
const customSections = [
{
id: 'step1',
title: 'Data Retrieval',
subtitle: '3 sources processed',
icon: ,
content: 'Data retrieved successfully'
}
] isOpen={true}
sections={customSections}
score="100"
mdComponents={{
a: ({ node, ...props }) =>
}}
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
reasoning | string | Markdown text explaining the AI's logic |
| gap | string | Markdown text explaining missing info or uncertainties |
| score | string | Confidence score percentage (e.g., "92") |
| isOpen | boolean | Controls the visibility of the expanded card |
| onToggle | () => void | Callback handler for the pill trigger click |
| title | string | Header title. Default: "Cognitive Decisioning AI" |
| hideTrigger | boolean | If true, hides the pill button |
| sections | SectionContent[] | Advanced: Overrides default Reasoning/Gap sections |
| mdComponents | Object | Custom renderers for react-markdown |
| headerIcon | ReactNode | Replaces the default brain icon |
| reasoningIcon | ReactNode | Replaces the icon for the reasoning section |
| gapIcon | ReactNode | Replaces the icon for the gap section |
| scoreIcon | ReactNode | Replaces the sparkle icon in the score badge |---
CognitiveInternalGPTReasoning
$3
The CognitiveInternalgptReasoningComponent is a React component designed to render non-web search reasoning citations with advanced interactive features. It provides a comprehensive display of reasoning data with support for expandable content, highlight navigation, and modal fullscreen viewing. This component is particularly useful for displaying AI-generated reasoning, training data citations, and confidence scores in a user-friendly format.
$3
- Expandable Content - Display a paraphrase text that expands to show the full data source content
- Highlight Navigation - Automatically extract and navigate between highlighted sections within the content
- Confidence Score Display - Show confidence percentage in both expanded view and modal
- Fullscreen Modal View - Open a fullscreen modal for detailed examination of reasoning data
- Text Formatting Support - Handle bold text, list items, headers, and special highlight tags
- Custom Icon Support - Replace default icons with custom React components
$3
`tsx
import NonWebReasoningComponent from '@e-llm-studio/citation/CognitiveInternalgptReasoningComponent'const reasoningData = {
text: "Reasoning text here",
dataSource: "Source with highlighted text ",
trainingDataTitle: "Training Dataset v1.0",
confidence_score: 95,
paraphrase: "Brief summary"
}
item={reasoningData}
index={1}
headerTitle="GPT Reasoning"
/>
`Highlight Navigation:
- Extracts
tags from dataSource
- Provides navigation between highlighted sections
- Shows current position (e.g., "2/5 highlights")
- Auto-scrolls to active highlight---
CodeCitation
$3
CodeCitation is a composable React UI component for rendering code citations with interactive features, syntax highlighting, and customizable display modes. It provides developers with a powerful tool for displaying code snippets with syntax highlighting, diagnostics, and theme support.
$3
- Inline and popup citation views - Flexible display modes for different use cases
- Syntax highlighting - Support for multiple programming languages
- Dark/Light mode theme toggling - Accessibility and user preference support
- Code highlighting - Highlight specific lines or variables
- Displaying diagnostics - Show errors and warnings with customizable styling
- Fetching code from backend - Support for dynamic code retrieval
- Customizable UI - Extensive customization through props and inline styles
- Fullscreen view support - View code in fullscreen modal
- Responsive design - Works well on various screen sizes
$3
`tsx
import { CodeCitation } from '@e-llm-studio/citation/CodeCitation' citationTitle="Example Code"
filename="example.js"
filepath="/src/example.js"
customCode={
function hello() { return "world"; }}
inLineCitation={true}
isDarkModeEnabled={false}
showThemeToggle={true}
editorHeight={400}
/>
`Advanced Features:
`tsx
const diagnostics = [
{
range: { lineStart: 2, lineEnd: 2, columnStart: 6, columnEnd: 11 },
severity: 1
}
]const highlightRanges = [
{
startIndex: 2,
endIndex: 5,
color: 'rgba(255, 255, 0, 0.3)',
lightModeColor: 'rgba(255, 255, 0, 0.2)'
}
]
customCode={sampleCode}
diagnostics={diagnostics}
diagnosticStylesBySeverity={{
1: { style: { backgroundColor: 'rgba(255,0,0,0.2)' } }
}}
startIndex={2}
endIndex={5}
isHighlightingEnabled={true}
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
citationTitle | string | Display name for the citation |
| filename | string | Filename with extension to identify the language |
| filepath | string | File path for reference |
| customCode | string | The code string to display in the editor |
| inLineCitation | boolean | Set to true for inline display or false for popup modal |
| isDarkModeEnabled | boolean | Enable dark theme by default |
| showThemeToggle | boolean | Display theme toggle button |
| editorHeight | number | Height of the code editor in pixels |
| editorWidth | string \| number | Width of the code editor |
| baseUrlForCodeRetrieval | string | Base URL for fetching code from backend |
| assistantName | string | Name of the assistant for context |
| organizationName | string | Name of the organization |
| userId | string | User ID for tracking |
| taskId | string | Task ID for context |
| repoUrl | string | Repository URL for reference |
| showFullscreenIcon | boolean | Display fullscreen toggle button |
| showFileSummaryIButton | boolean | Display file summary info button |
| isHighlightingEnabled | boolean | Enable code highlighting |---
CitationsViewer
$3
The Citation Viewer is a rich, interactive React component designed to display AI-generated audio citations. It features a synchronized audio waveform player, a transcript view that highlights active segments, and a summary of key takeaways. This component is ideal for displaying RAG (Retrieval-Augmented Generation) results where the source material is audio or video, allowing users to listen to the specific segment referenced by the AI.
$3
- Interactive Waveform - Visualizes audio using
wavesurfer.js with playback controls
- Smart Highlighting - Automatically highlights the specific time range referenced in the citation on the waveform
- Synchronized Transcript - Displays chat history and highlights the active message segment
- Key Takeaways - Renders extracted insights with bold text formatting and keyword tags
- GCS Integration - Built-in hook to resolve Google Cloud Storage (gs://) URLs to signed URLs via a backend endpoint
- Themable - Fully customizable colors and typography via a theme config object$3
`tsx
import CitationsViewer from '@e-llm-studio/citation/CitationsViewer' artifact={{
baseUrl: "https://api.example.com",
artifactTitle: "Quarterly Earnings Call",
fileUrl: "gs://bucket/audio.mp3",
chatHistory: [
{
role: "Speaker 1",
message: "Revenue increased by 20%",
timestamp: "10:30",
timestamp_start: 120.5,
timestamp_end: 125.0
}
],
keyTakeaways: [
{
takeawayId: "1",
name: "Revenue Growth",
content: "20% year-over-year growth",
keywords: ["Revenue", "Growth"]
}
]
}}
onCloseHandler={() => console.log('Closed')}
/>
`$3
| Prop Name | Type | Required | Description |
|-----------|------|----------|-------------|
|
artifact | ArtifactData | ✅ | The main data object containing audio, transcript, and metadata |
| onCloseHandler | () => void | ❌ | Callback function triggered when the close (X) button is clicked |
| theme | ThemeConfig | ❌ | Object to override default colors and fonts |
| iconsConfig | IconsConfig | ❌ | Object to inject custom React icons (Play, Pause, Close) |---
PdfEditorCitation
$3
PdfEditorCitation is a core component for the Advanced Document Management and Citation System. It provides a user-friendly interface for viewing, editing, and citing PDF documents directly within the application. It combines interactive PDF viewing capabilities with a collapsible UI pattern, allowing users to manage document space efficiently while maintaining full access to PDF editing and annotation features.
$3
- Collapsible PDF viewer functionality - Users can expand and collapse the PDF editor section
- Interactive PDF editing capabilities - Full support for PDF editing, annotations, and collaborative features
- Sentence highlighting support - Ability to highlight specific sentences within PDF documents
- Customizable UI through CSS classes - Flexible styling options for seamless integration
$3
`tsx
import { PdfEditorCitation } from '@e-llm-studio/citation/PdfEditorCitation' citationTitleElement={
Research Paper.pdf}
pdfUrl="https://example.com/document.pdf"
pdfEditorBackendBaseUrl="https://pdf-backend.example.com"
sentenceHighlightDetails={{
pdfPageNumber: 5,
sentenceToHighlight: "key finding in the research"
}}
currentUserId="user-123"
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
citationTitleElement | ReactElement | A React element to display as the clickable title |
| pdfUrl | string | The URL of the PDF file to be displayed and edited |
| pdfEditorBackendBaseUrl | string | The base URL of the PDF editor backend service |
| citationRootClassName | string | Optional CSS class name for the root container |
| citationBodyClassName | string | Optional CSS class name for the body section |
| citationBodyWhenCollapsedClassName | string | Optional CSS class name for collapsed state |
| citationTitleClassName | string | Optional CSS class name for the title section |
| rlefEventServiceBaseUrl | string | Optional base URL for the RLEF event service |
| currentUserId | string | Optional user ID of the current user |
| sentenceHighlightDetails | object | Optional sentence highlighting configuration |---
RequirementAICitation
$3
RequirementAICitation is a comprehensive React module for displaying AI-generated insights and rich media evidence. It serves two primary purposes: displaying an AI Reasoning Card with expandable sections for logic, gaps, and confidence scores with embedded citations, and providing standalone media citations for Files, Images, and Web Links.
$3
- AI Reasoning Card - Complex, expandable card displaying AI logic, gaps, and confidence scores with embedded, clickable citations
- Standalone Media Citations - Individual, stylized citation pills for Files, Images, and Web Links
- Multiple Citation Types - Support for file citations (PDFs), image citations, and web citations
- Relevance Scoring - Display AI relevance scores for all citation types
- Rich Media Preview - Integrated viewers for PDFs, images, and web content
- Customizable Styling - Deep CSS injection for all components
$3
`tsx
import { AiReasoningCitation } from '@e-llm-studio/citation' title="AI Analysis"
aiReason={{
id: "1",
relevance_score: 95,
reason: "The ADK.pdf mentions...",
gap: "Registry mechanism undefined"
}}
citationList={{
file_citations: [{
citation_number: "1",
customMetadata: {
type: "book_citation_pdf",
file_name: "ADK.pdf",
highlighted_pdf_signed_url: "https://storage.googleapis.com/..."
}
}]
}}
aiReasoningAccordionProps={{
icons: {
chevronUp: ,
chevronDown:
}
}}
/>
`Embedded Citation Types:
1. FileCitationContent: PDF documents with signed URLs
2. ImageCitationContent: Images with relevance scores
3. WebCitationWithImageContent: Web pages with screenshots
Standalone Media Citations:
`tsx
import { CitationRenderer, FileCitationContent } from '@e-llm-studio/citation' inLineCitation={true}
citationTitle="Technical Spec.pdf"
citationComponent={
title="Spec.pdf"
relevanceScore={88}
signedUrl="https://example.com/sample.pdf"
styles={{ pdfWrapper: { height: "750px" } }}
/>
}
/>
`
$3
| Prop Name | Type | Required | Description |
|-----------|------|----------|-------------|
|
title | string | ✅ | Title on the main pill |
| aiReason | TAIReasoning | ✅ | Contains reason, gap, relevance_score |
| citationList | Citations | ✅ | Lookup object for all referenced files/images |
| aiReasoningAccordionProps | Object | ✅ | Must contain icons: { chevronUp, chevronDown } |
| projectDetails | Array | ❌ | Context for specific app-mod logic |
| cachingConfig | Object | ❌ | If using gsUtilPath instead of signedUrl |---
Other Components
Bookemon
$3
Bookemon is a composable, dialog-based React UI component designed for deep book inspection. It features a resizable split-panel layout that allows users to browse detailed metadata while simultaneously viewing and interacting with specific manuscript content. The component is designed to be highly customizable via style injections and handles complex logic for smart text citation, server-side pagination, and focus-mode blurring.
$3
- Resizable split-panel layout - Left panel for metadata, right panel for content preview
- Deep book inspection - Browse detailed metadata including overview, elements, copyrights, and awards
- Smart text citation - Automatically highlights and focuses on specific text passages
- Server-side pagination - Efficiently handles large datasets with pagination support
- Focus-mode blurring - Blur non-highlighted text to focus reader attention on relevant content
- Highly customizable styling - Inject custom styles for layout containers and citation elements
- Interactive accordions - Collapsible sections for book metadata organization
$3
`tsx
import Bookemon from '@e-llm-studio/citation/Bookemon' open={isOpen}
onClose={() => setIsOpen(false)}
data={bookData}
getHighlightContent={fetchContent}
isBlurToggleVisible={true}
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
open | boolean | Controls the visibility of the dialog |
| onClose | () => void | Callback function triggered when the dialog is closed |
| data | BookemonData | Object containing book metadata and elements |
| getHighlightContent | (chunkIds: string[]) => Promise | Async handler to fetch content for highlighting |
| handleFetchManuscriptElements | (params: FetchElementsParams) => Promise | Async handler for fetching paginated manuscript elements |
| isBookemon | boolean | Default: true. Feature flag for Bookemon-specific behavior |
| isBlurToggleVisible | boolean | Default: false. Shows the blur switch in header |
| isNonHighlightedBlur | boolean | Default: false. Initial blur state |
| showComingSoon | boolean | Default: false. Gates the UI with coming soon overlay |
| customStyle | BookemonCustomStyles | Optional custom styles for layout and citation elements |---
DatagestMon
$3
DatagestMon is a React component for monitoring and displaying structured data from processing stages (analysis, transform, rag). It provides a comprehensive interface that combines dynamic data visualization with an integrated EPUB viewer. The component uses Material-UI Dialog for display and includes a built-in EPUB reader powered by react-reader.
$3
- Multi-stage data display - Visualize data from analysis, transform, and rag stages
- Processed and error data - Display both successful processing results and error information
- Integrated EPUB viewer - View associated EPUB content side-by-side with data
- Dynamic data visualization - Automatically render various data types
- Material-UI Dialog - Professional modal presentation
- Graceful error handling - Handle missing or malformed data gracefully
$3
`tsx
import DatagestMon from '@e-llm-studio/citation/DatagestMon'const pipelineData = {
"analysis": {
"processed_data": {
"summary": "Analysis completed",
"functions": "15 functions extracted"
},
"error_data": {
"rate_limit_exceeded": true
}
},
"transform": {
"processed_data": {
"embeddings": 123,
"transformed_records": 1200
},
"error_data": {}
}
}
open={isOpen}
onClose={() => setIsOpen(false)}
data={pipelineData}
url="https://example.com/document.epub"
/>
`$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
open | boolean | Controls whether the dialog is open or closed |
| onClose | function | Callback function triggered when the dialog is closed |
| data | object | Object containing structured data from processing stages |
| url | string | Optional URL of the EPUB file to display in the viewer |---
DataSelector
$3
DataSelector is a robust, multi-step wizard designed to handle complex data import workflows. It acts as a central hub where users can select data from various sources—including remote RLEF projects, historical copilot data, saved datasets, or local file uploads—and aggregates them into a unified selection state. It features a built-in state machine for navigation, breadcrumb management, and context-driven state sharing.
$3
- Multi-step wizard interface - Guide users through complex data selection workflows
- Multiple data sources - Support for RLEF projects, historical data, saved datasets, and local files
- Breadcrumb navigation - Easy navigation through wizard steps
- Server-side pagination - Efficiently handle large datasets
- Search and filtering - Find data quickly with built-in search
- State machine navigation - Robust step management
- Context-driven state sharing - Centralized state management via React Context
$3
`tsx
import { DataSelectedContextProvider } from '@e-llm-studio/citation/context/DataSelectedContext'
import DataSelector from '@e-llm-studio/citation/DataSelector'
pageTitle="Import Dataset"
selectedRlefResources={resources}
setSelectedRlefResources={setResources}
selectedLocalFiles={files}
setSelectedLocalFiles={setFiles}
/>
`Wizard Steps:
1. Data source selection - Choose from RLEF, Local, Google Drive, Saved Datasets
2. Project/task selection - Select specific projects or tasks
3. Data collection selection - Choose from available data collections
4. Data point selection - Select specific data points within collections
5. Final review - Review and confirm selections
$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
selectedRlefResources | Array | Initial array of selected remote resources |
| setSelectedRlefResources | Function | State setter for remote resources |
| selectedLocalFiles | Array | Initial array of selected local files |
| setSelectedLocalFiles | Function | State setter for local files |
| pageTitle | string | Customizes the header text |
| renderDefaultActionsFooter | boolean | Show/hide the default "Next" button |---
PaginatedTable
$3
PaginatedTable is a high-performance React component designed to display large datasets efficiently. It leverages virtualization (via react-window) to render only the visible rows, ensuring smooth scrolling even with thousands of records. It also supports infinite scrolling, automatically triggering a "load more" callback when the user scrolls near the bottom.
$3
- Virtualization - Efficiently renders massive datasets using windowing
- Infinite scroll - Automatically calls onNextPage when scrolling to the bottom
- Sticky headers - Headers remain visible while scrolling vertically
- Horizontal scrolling - Handles wide tables with a custom scrollbar
- Loading states - Displays a skeleton loader row when fetching more data
- Customizable - Supports custom dimensions and granular style overrides
$3
`tsx
import PaginatedTable from '@e-llm-studio/citation/PaginatedTable' headers={["ID", "Name", "Email", "Status"]}
tableData={users}
totalFileRecords={10000}
onNextPage={fetchNextPage}
loadingMore={isLoading}
headerRefs={headerRefs}
columnWidth={200}
rowHeight={50}
style={{ height: "600px" }}
/>
`Performance Characteristics:
- Renders only visible rows (windowed rendering)
- Handles thousands of rows efficiently
- Smooth scrolling even with large datasets
- Memory efficient for large data volumes
$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
headers | string[] | An array of column header names |
| tableData | Object[] | Array of data objects where keys match the headers |
| onNextPage | () => void | Callback triggered when scrolling near the bottom |
| headerRefs | RefObject | A ref object to store references to header DOM elements |
| totalFileRecords | number | The total count of records available on the server |
| loadingMore | boolean | If true, shows a skeleton loader at the bottom |
| columnWidth | number | Fixed width (in px) for every column |
| rowHeight | number | Fixed height (in px) for every row |
| className | string | Custom CSS class for the main container |
| style | CSSProperties | Inline styles for the main container |
| styleOverrides | Object | Granular styles for internal elements |---
PdfViewer
$3
PdfViewer is a specialized React component designed to render PDF documents with built-in capabilities for text highlighting and highlight navigation. It is built on top of the @react-pdf-viewer library and is optimized for review workflows. It takes a specific list of keywords to highlight and a list of relevant pages, allowing users to "jump" directly between pages that contain relevant information.
$3
- Text highlighting - Automatically highlight keywords within the document
- Highlight navigation - Jump between pages with relevant content
- Zoom controls - In/out zoom and popover zoom options
- Page navigation - Navigate between highlighted pages
- Custom toolbar - Sticky header with navigation controls
- Responsive design - Works well on various screen sizes
$3
`tsx
import PdfViewer from '@e-llm-studio/citation/PdfViewer' pdfUrl="https://example.com/contract.pdf"
highlightText={["confidential", "termination", "liability"]}
highlightPages={[3, 8, 12]}
jumpToPageValue={3}
/>
`$3
- "Next" button jumps to next page with highlights
- "Previous" button jumps to previous highlighted page
- Direct page navigation based on highlightPages array
- Auto-zoom to actual size on load
$3
| Prop Name | Type | Description |
|-----------|------|-------------|
|
pdfUrl | string | The direct URL to the PDF file to be rendered |
| highlightText | string[] | An array of keywords or phrases to automatically highlight |
| highlightPages | number[] | An array of page numbers (1-based) where highlights appear |
| jumpToPageValue | number | The specific page number to open the document at initially |---
ProjectAccordion
$3
ProjectAccordion is a React component designed to display project-related information in an accordion format. Further details to be added.
$3
- Expandable/collapsible accordion design
- Markdown rendering for executive summaries
- Checkbox selection support
- API integration for fetching summaries
- Customizable styling
$3
`tsx
import ProjectAccordion from '@e-llm-studio/citation/ProjectAccordion' baseUrl="https://api.example.com"
taskId="project-123"
citationTitle="Executive Summary"
isChecked={selected}
onCheckChange={(checked) => setSelected(checked)}
chevronUpComponent={ }
chevronDownComponent={ }
styles={{
pillButton: {
fontFamily: 'Plus Jakarta Sans, sans-serif',
border: '0px',
padding: '8px',
cursor: 'pointer'
}
}}
/>
`$3
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| baseUrl | string | Yes | API base URL |
| taskId | string | Yes | Task/project identifier |
| citationTitle | string \| ReactNode | Yes | Accordion header title |
| isChecked | boolean | No | Controlled checkbox state |
| onCheckChange | function | No | Checkbox change callback |
| execSummary | string | No | Pre-fetched summary text |---
UploadData
$3
UploadData is a feature within the DataSelector component that handles data import from various sources. It provides a comprehensive interface for users to upload data from multiple sources including RLEF projects, Google Drive, local file systems, and saved datasets. The role of its sub-components is to manage the data selection process across different data sources.
$3
- Multiple data source support - Import from RLEF, Google Drive, local files, and saved datasets
- Unified selection interface - Aggregate data from various sources
- File upload handling - Support for local file uploads
- Cloud integration - Google Drive integration for cloud-based data
- Saved dataset management - Access and manage previously saved datasets
$3
`tsx
import { UploadData } from '@e-llm-studio/citation'
import { DataSelectedProvider } from '@e-llm-studio/citation/context/DataSelectedContext'
`$3
- RLEF Projects: Data from Research Learning Ecosystem Framework
- Google Drive: Cloud-based file storage
- Local Files: Direct file upload from device
- Saved Datasets: Previously saved data collections
Integration Example:
`tsx
import { useSelectDataContext } from '@e-llm-studio/citation/context/DataSelectedContext'const MyComponent = () => {
const { selectedRlefResources, saveSelectedDataAsDataSet } = useSelectDataContext()
return (
)
}
`---
Common Use Cases
$3
`tsx
// Display book citations in RAG responses
citationTitle="Source: Machine Learning Textbook"
paragraphs={[relevantParagraph]}
textToHighlight={[queryKeywords]}
/>// Show AI reasoning behind answers
score="88"
reasoning="Based on chapter 3 of the textbook..."
gap="The textbook doesn't cover recent developments after 2020"
/>
`$3
`tsx
// Display code snippets with diagnostics
filename="utils.js"
customCode={problematicCode}
diagnostics={lintErrors}
isHighlightingEnabled={true}
startIndex={errorLine - 1}
endIndex={errorLine + 1}
/>// Show training data citations for code explanations
item={trainingDataCitation}
index={1}
headerTitle="Training Data Reference"
/>
`$3
`tsx
// Show audio citations with synchronized transcripts
artifact={audioAnalysis}
onCloseHandler={closePlayer}
/>// Display key takeaways from audio content
artifact={{
fileUrl: "gs://bucket/interview.mp3",
keyTakeaways: [
{
takeawayId: "1",
name: "Key Insight",
content: "Important finding from the interview",
keywords: ["insight", "finding"]
}
]
}}
/>
`$3
`tsx
// PDF review with highlighting
pdfUrl={contractUrl}
highlightText={keyClauses}
highlightPages={relevantPages}
/>// Collaborative PDF editing
citationTitleElement={
Legal Document.pdf}
pdfUrl={legalDocUrl}
currentUserId={user.id}
pdfEditorBackendBaseUrl="https://pdf-backend.example.com"
/>
`$3
`tsx
// Multi-step data import wizard
pageTitle="Import Training Data"
selectedRlefResources={trainingData}
setSelectedRlefResources={setTrainingData}
/>
// Upload interface wrapper
`$3
`tsx
// Virtualized table for large datasets
headers={columns}
tableData={largeDataset}
totalFileRecords={100000}
onNextPage={loadMoreData}
loadingMore={loading}
style={{ height: "500px" }}
/>
`---
Development & Contribution
Contributions are welcome! This guide walks you through making changes to the citation library.
$3
- Node.js & npm installed
- Git installed
- Basic familiarity with Git and the command line
$3
1. Fork & Clone the Repository
`bash
git clone https://github.com//citation.git
cd citation
`2. Install Dependencies
`bash
npm install
`3. Link the Library Locally (Optional - for testing before publishing)
`bash
git checkout -b my-change-branch
npm link
# In your test project folder
npm link @e-llm-studio/citation
`4. Build the Library
`bash
npm run build
`5. Test Locally
- Start or build your test project to verify changes work as expected
- Ensure all existing tests pass
$3
- Edit source files in the
src/ directory
- Add or update tests as needed
- Follow the existing code style and formatting guidelines
- Ensure your changes are well-documented with comments$3
1. Commit Your Changes
`bash
git add .
git commit -m "fix: describe your change"
git push origin my-change-branch
`2. Submit a Pull Request
- Open a pull request on GitHub with a clear description of your changes
- Reference any related issues
- Ensure all tests pass before submitting
$3
When publishing updates, follow Semantic Versioning:
`bash
npm version patch # for bug fixes
npm version minor # for new features
npm version major # for breaking changes
`For more details, refer to the npm version documentation.
$3
> Ensure you have npm account permissions and are on the correct branch.
`bash
npm login
npm publish --access public
`After publishing, verify the package:
`bash
npm unlink @e-llm-studio/citation
npm install @e-llm-studio/citation@latest
`$3
- Use
npm pack to generate a .tgz and test installation before publishing
- Open a Pull Request when ready for review
- We appreciate your help in improving the citation library through bug fixes, feature enhancements, and documentation improvements---
License
This library is released under the MIT License. See the LICENSE file for more details.
The license information is also available in the
citation/package.json` file under the 'license' field.