Marker
Quiet notes between content, like date dividers and system events, with sticky dates and times that read as Today or Yesterday.
- Chat UI components
- 4 parts
- 7 examples
@base-ui/reactclass-variance-authority
See it in a real product: Chat Thread
View blockpnpm dlx shadcn@latest add https://hextaui.com/r/marker.jsonAdds the component, the HextaUI theme tokens and any HextaUI components it depends on.
Add the theme tokens to your global CSS, if you haven’t yet.
Install the dependencies.
pnpm add @base-ui/react class-variance-authority cnCopy and paste the following code into your project.
components/ui/marker.tsx Update the import paths to match your project setup.
default is a quiet note, separator centers it between two hairlines, and border underlines it like a section heading.
With sticky, a marker stays at the top of its scroll area. Once it sticks, its lines fade and the label turns into a floating pill so it stays readable over messages. Put each day in its own section so the next date pushes the previous one away.
<MarkerTime /> renders a <time> that reads Today, Yesterday, a weekday within the last week, then a short date. It updates itself at midnight. Pass format for your own wording.
Render markers as list items for an activity log. Links inside are underlined until hovered.
Notes wrap and unbroken strings break instead of widening the layout. Separator lines keep a minimum length on both sides.
Icons and text follow the reading direction.
- Markers are plain text, so screen readers read them in place. Icons are hidden from them.
<MarkerTime />keeps the exact moment indateTimewhile showing a friendly label.- The sticky pill appears without motion when reduced motion is on.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "separator" | "border" | "default" |
stickyStick to the top of the scroll area and become a pill while stuck. | boolean | false |
render | ReactElement | (props, state) => ReactElement | <div> |
| Attribute | Description |
|---|---|
data-slot="marker" | Target markers in CSS. |
data-variant | The current variant. |
data-sticky | Present when sticky is on. |
data-stuck | Present while the marker is stuck to the top. |
--marker-sticky-top | Distance from the top while stuck. Defaults to 0.5rem. |
| Attribute | Description |
|---|---|
data-slot="marker-content" | The text. Becomes the pill while stuck. |
| Attribute | Description |
|---|---|
data-slot="marker-icon" | A 16px icon box, hidden from screen readers. |
| Prop | Type | Default |
|---|---|---|
dateRequired. Anything new Date() accepts. | Date | string | number | – |
localeFixed by default so the server and browser agree. | Intl.LocalesArgument | "en-US" |
formatReplace the relative label with your own. | (date: Date) => ReactNode | – |
| Attribute | Description |
|---|---|
data-slot="marker-time" | The time element, with an ISO dateTime. |
- AttachmentFile and image cards for uploads, with progress, states, actions, a full-card trigger and names that keep their extension.
- BubbleChat message bubbles with variants, grouped corners, reactions and room for interactive content.
- MessageA chat message row with an avatar, name, bubbles and status, where new messages rise in from the sender's side.
- Message scrollerA chat scroll area that follows new messages, keeps your place while you read back, and counts what you missed on the jump button.
Used in Pro blocks
Blocks that build on Marker.
Every block comes with HextaUI Pro, and Prompt Input is free.