Lemma Comments
lemma/lemma-commentsFreeBlock
A record-scoped comment thread with author avatars, relative timestamps, inline reply input, and function-aware comment creation. For collaborative record discussion.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/lemma-work/lemma-platform/main/lemma-typescript/public/r/lemma-comments.jsonSource
1"use client"23import * as React from "react"4import {5 MessageSquare,6 RefreshCw,7 Send,8 User,9} from "lucide-react"10import { Button } from "@/components/lemma/ui/button"11import { Skeleton } from "@/components/lemma/ui/skeleton"12import { Textarea } from "@/components/lemma/ui/textarea"13import { useReferencingRecords, useCreateRecord } from "lemma-sdk/react"14import type { LemmaClient } from "lemma-sdk"15import { cn } from "@/components/lemma/lib/utils"16import { enumPillClasses, type EnumColorMap } from "./comments-enum-utils"17import {18 commentsRadiusClassName,19 type LemmaCommentsAppearance,20 type LemmaCommentsDensity,21 type LemmaCommentsRadius,22} from "./comments-style-utils"2324export type { LemmaCommentsAppearance, LemmaCommentsDensity, LemmaCommentsRadius } from "./comments-style-utils"2526export interface LemmaCommentsProps {27 client: LemmaClient28 podId?: string29 tableName: string30 foreignKey: string31 recordId: string32 enabled?: boolean3334 bodyField?: string35 authorField?: string36 createdAtField?: string3738 submitVia?: "direct" | "function"39 submitFunctionName?: string4041 enumColorMap?: EnumColorMap4243 appearance?: LemmaCommentsAppearance44 density?: LemmaCommentsDensity45 radius?: LemmaCommentsRadius4647 onCommentClick?: (comment: Record<string, unknown>) => void48 title?: React.ReactNode49 headerActions?: React.ReactNode50 className?: string51}5253export function LemmaComments({54 client,55 podId,56 tableName,57 foreignKey,58 recordId,59 enabled = true,60 bodyField = "body",61 authorField = "author_user_id",62 createdAtField = "created_at",63 submitVia = "direct",64 submitFunctionName,65 enumColorMap,66 appearance = "default",67 density = "comfortable",68 radius = "lg",69 onCommentClick,70 title,71 headerActions,72 className,73}: LemmaCommentsProps) {74 const [newBody, setNewBody] = React.useState("")7576 const commentsState = useReferencingRecords({77 client,78 podId,79 table: tableName,80 foreignKey,81 recordId,82 sortBy: createdAtField,83 order: "asc",84 enabled,85 })8687 const createRecord = useCreateRecord({88 client,89 podId,90 tableName,91 enabled,92 createVia: submitVia,93 createFunctionName: submitFunctionName,94 onSuccess: () => {95 setNewBody("")96 commentsState.refresh()97 },98 })99100 const handleSubmit = async () => {101 const trimmed = newBody.trim()102 if (!trimmed || createRecord.isSubmitting) return103 await createRecord.create({104 [bodyField]: trimmed,105 [foreignKey]: recordId,106// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from lemma
All 20 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Lemma Action Surfacelemma-action-surface | lemma | Blocks | Free | 4 deps | |
| Lemma Activity Feedlemma-activity-feed | lemma | Blocks | Free | 4 deps · 3 files | |
| Lemma Agent Conversation Experiencelemma-assistant-experience | lemma | Blocks | Free | 7 deps · 3 files | |
| Lemma Breadcrumbslemma-breadcrumbs | lemma | Blocks | Free | 3 deps | |
| Lemma Detail Panellemma-detail-panel | lemma | Blocks | Free | 4 deps · 7 files | |
| Lemma Document Workspacelemma-document-workspace | lemma | Blocks | Free | 6 deps | |
| Lemma File Browserlemma-file-browser | lemma | Blocks | Free | 4 deps | |
| Lemma Global Searchlemma-global-search | lemma | Blocks | Free | 4 deps |
