What is UI Comment SDK?
This SDK enables teams to add visual comments and feedback directly on
any web page or app UI. It's designed for developers, designers, and
QA teams who need to collaborate, review, and discuss UI elements in
real time or asynchronously.
Easy integration: Plug-and-play with any project, just provide your backend API for comment storage.
Visual feedback: Pin comments to specific UI elements for clear context.
Collaboration: Streamline design reviews, bug reporting, and team discussions.
Flexible: Works with static sites, React, and more.
Export CSV: Easily export all comments as a CSV file for reporting or analysis.
1. Press Ctrl + E or click the comment icon to toggle comment mode.
2. Click on any element below to add a comment โ SDK shows the comment form
3. Click on existing comment bubbles to view and reply to comments
4. Use the sidebar to browse all comments and navigate between them
โจ What the SDK handles: All UI components (forms, bubbles, modals, sidebar) - you only need to provide API callbacks for data persistence!
onFetchJsonFile
and onUpdate
functions
Quick Start: You only need projectId to get started!
Field | Type | Required | Description |
---|---|---|---|
projectId
|
string | Required | Your project name. Creates localStorage key: ui-cm-${projectId} |
saveLocalStorage
|
boolean | Optional |
true =
Save to browser storage false = Use your API |
onFetchJsonFile
|
function | Optional | Load comments from your API. Returns: { comments: Comment[] } |
onUpdate
|
function | Optional | Save comments to your API. Receives: Comment[] |
Perfect for: Demos, prototypes, testing
Setup: Just set saveLocalStorage: true
Data stored: In browser's localStorage
Perfect for: Real apps, team collaboration
Setup: Set saveLocalStorage: false + add API functions
Data stored: In your database/server
const sdk = initCommentSDK({ projectId: "my-app", saveLocalStorage: true });
const sdk = initCommentSDK({ projectId: "my-app", saveLocalStorage: false, onFetchJsonFile: async () => { return await fetch("/api/comments").then(r => r.json()); }, onUpdate: async (comments) => { await fetch("/api/comments", { method: "PUT", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(comments) }); } });
<script src="https://unpkg.com/ui-comment-sdk@latest/dist/ui-comment-sdk.min.js"></script>
<script>
const sdkDemo = UICommentSDK.initCommentSDK({
projectId: "my-project",
saveLocalStorage: true, // Enable auto localStorage handling
// Optional API callbacks (only needed if saveLocalStorage: false)
onFetchJsonFile: async () => {
return await fetch("/api/comments.json").then(r => r.json());
},
onUpdate: async (comments) => {
await fetch("/api/comments.json", {
method: "PUT",
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(comments)
});
}
});
await sdkDemo.init();
</script>
// 1. Install the package npm install ui-comment-sdk // 2. Create a React component import { useEffect } from 'react'; import { initCommentSDK } from 'ui-comment-sdk'; function CommentSDKWrapper() { useEffect(() => { const sdk = initCommentSDK({ projectId: "my-react-project", saveLocalStorage: true, // Enable auto localStorage handling // Optional API callbacks (only needed if saveLocalStorage: false) onFetchJsonFile: async () => { return await fetch("/api/comments.json").then(r => r.json()); }, onUpdate: async (comments) => { await fetch("/api/comments.json", { method: "PUT", headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(comments) }); } }); // Initialize SDK sdk.init(); // Cleanup on unmount return () => { sdk.destroy(); }; }, []); return null; // SDK renders its own UI } // 3. Use in your app function App() { return ( <div> <h1>My React App</h1> <p>Click Ctrl+E to toggle comment mode!</p> <CommentSDKWrapper /> </div> ); }
BIN_ID
and MASTER_KEY
in the code
below
onFetchJsonFile
and
onUpdate
callbacks
Why JSONBin.io? Free, simple, and perfect for demos and prototypes. No server needed and no token complexity!
// 1. JSONBin.io Configuration const BIN_ID = "your-bin-id-here"; // Any unique ID you want const MASTER_KEY = "$2a$10$your-master-key-here"; // From JSONBin.io // 2. Setup API functions async function fetchFromBin() { const response = await fetch(`https://api.jsonbin.io/v3/b/${BIN_ID}`, { headers: { "X-Master-Key": MASTER_KEY } }); const data = await response.json(); return { comments: data.record?.comments || [] }; } async function saveToBin(data) { await fetch(`https://api.jsonbin.io/v3/b/${BIN_ID}`, { method: "PUT", headers: { "X-Master-Key": MASTER_KEY, "Content-Type": "application/json" }, body: JSON.stringify(data) }); }
// Express.js example - Simple JSON file approach const express = require('express'); const fs = require('fs'); const app = express(); app.use(express.json()); // Serve JSON file app.get('/api/comments.json', (req, res) => { try { const data = fs.readFileSync('./comments.json', 'utf8'); res.json(JSON.parse(data)); } catch (error) { // Return empty structure if file doesn't exist res.json({ comments: [] }); } }); // Update JSON file app.put('/api/comments.json', (req, res) => { try { const data = { projectId: "my-project", comments: req.body, lastUpdated: new Date().toISOString() }; fs.writeFileSync('./comments.json', JSON.stringify(data, null, 2)); res.json({ success: true }); } catch (error) { res.status(500).json({ error: error.message }); } }); app.listen(3000, () => { console.log('Server running on http://localhost:3000'); });
Perfect for static websites and quick prototypes
<script src="https://unpkg.com/ui-comment-sdk@latest/dist/ui-comment-sdk.min.js"></script>
For React, Vue, and modern JavaScript projects
npm install ui-comment-sdk