Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Comment

comment

Displays nested comments with reply indentation, optional connectors, and action slots.

Usage

Basic usage

Avatar + Author + Time + Text, the string text will automatically highlight @mention.

Hu
Hulian2 hours ago
The work order has been assigned, please @Li Si follow up.
tsx
<Comment
  author="Hulian"
  avatar={{ fallback: "hu" }}
  datetime="2 hours ago"
  content="The work order has been assigned, please @Li Si follow up."
/>

Operation area

actions slot CommentAction, pass href to render as a link operation.

Hu
Hulian2 hours ago
This comment has like and reply operations.
Reply
tsx
<Comment
  author="Hulian"
  avatar={{ fallback: "hu" }}
  datetime="2 hours ago"
  content="This comment has like and reply operations."
  actions={
    <>
      <CommentAction>👍 Like 12</CommentAction>
      <CommentAction href="#">Reply</CommentAction>
    </>
  }
/>

Nested reply + connecting line

children recursively Comment automatically indents, connector draws the left connecting line.

Hu
Hulian2 hours ago
The problem has been reproduced.
Li
Li Si1 hour ago
Received and investigating the root cause.
tsx
<Comment
  author="Hulian"
  avatar={{ fallback: "hu" }}
  datetime="2 hours ago"
  content="The problem has been reproduced."
  connector
>
  <Comment
    author="Li Si"
    avatar={{ fallback: "Li" }}
    datetime="1 hour ago"
    content="Received, root cause is being investigated."
  />
</Comment>

System log

type="log" is weakened to dot mark + single line inline (work order status change, etc.).

SystemChange the status of the work order to "Processing"14:25
Zhang Sanassigned to @Li Si14:26
tsx
<>
  <Comment type="log" author="System" content="Set the ticket status to Processing" datetime="14:25" />
  <Comment type="log" author="Zhang San" content="Assigned to @Li Si" datetime="14:26" />
</>

Reuse User author card

author can be passed directly into the Hulian User assembly.

Hu
Hulian@hulian
Just now
The author area can directly import the Hulian User assembly.
tsx
<Comment
  author={<User name="Hulian" description="@hulian" avatarProps={{ fallback: "Hu", size: "sm" }} />}
  datetime="Just now"
  content="The author area can directly import the Hulian User assembly."
/>

When to use

Use Comment to mix discussion replies, ticket comments, and system activity. type="comment" renders body content as a comment, while type="log" creates a muted inline log. [User] fits the author area, and RelativeTime fits timestamps.

Import

ts
import { Comment, CommentActions, CommentAction, commentActionVariants } from "@hulianui/ui"

Props

Comment

Props

NameTypeDefaultDescription
avatarAvatarProps-Props for Avatar; ignored by log entries in favor of a system marker.
type"comment" | "log""comment"Entry presentation.
connectorbooleanfalseDraws a left connector beside nested comments.
classNamestring-Remaining HTMLAttributes<HTMLElement> after omitting content and title.

Slots

SlotTypeDescription
author*ReactNodeAuthor name or composed User.
datetimeReactNodeRelative or absolute timestamp.
contentReactNodeBody below a comment, or inline after a log author.
actionsReactNodeLike or reply controls, commonly composed with CommentAction.
childrenReactNodeNested Comment replies with automatic indentation and optional connectors.

CommentAction

Props

NameTypeDefaultDescription
hrefstring-Renders a Hulian Link when set, otherwise a <button>.

Slots

SlotTypeDescription
childrenReactNodeAction content; remaining button attributes are forwarded.

Pitfalls

  • Log entries ignore avatar and render content inline. Use the default type for avatar-and-body comments.
  • Place nested Comment instances in children; indentation is automatic, while connectors require connector.
  • href decides whether CommentAction is a Link or button. Use a link for anchor navigation and a button for interactions.

Related

Sparkline · ImageViewer · LiveProductCard · DiffStat · ScoreRing · Badge

Playground

Hu
Hulian2 hours ago
This is a comment and can be nested into sub-replies.
Reply
Li
Li Si1 hour ago
This is a sub-reply.
<Comment
  author="Hulian"
  avatar={{ fallback: "hu" }}
  datetime="2 hours ago"
  content="This is a comment"
  connector
>
  <Comment author="Li Si" content="This is a sub-reply." />
</Comment>
PreviousQRCodeData DisplayNextRelativeTime

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Pitfalls
    • Related
  • Playground