Marker
Quiet notes between content, like date dividers and system events, with sticky dates and times that read as Today or Yesterday.
pnpm 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.
Variants
default is a quiet note, separator centers it between two hairlines, and border underlines it like a section heading.
Sticky dates
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.
Relative dates
<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.
Activity
Render markers as list items for an activity log. Links inside are underlined until hovered.
- Jun added the design label
- Mira renamed the pull request
- Sol merged into main
- Conversation locked
Long content
Notes wrap and unbroken strings break instead of widening the layout. Separator lines keep a minimum length on both sides.
Right to left
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. |