Marker
A status line, system note, bordered row or labelled divider inside a conversation.
Installation
Needs the arene setup first. Also adds Separator.
Install the packages it imports:
Set up the token layer and the StyleX compiler, if you have not already. See
Installation. The marker also needs interop.css, which
sizes the icons inside it and styles links inside its content.
Install Separator, whose styles draw the lines of
the separator variant.
Paste this source into the file named in its title.
Change the @/ imports if your project uses different aliases.
Usage
Composition
Variants
variant picks one of three shapes: inline, a bordered row or a labelled
separator.
| Variant | Description |
|---|---|
default | An inline marker for status, notes and actions |
border | A default marker with a hairline under the row |
separator | A centred label with a divider line on either side |
Status
Set role="status" and put a Spinner in
MarkerIcon for a streaming or in-progress marker, so the update is
announced.
Shimmer
Merge shimmerStyles.base into MarkerContent
through xstyle to animate streaming status text.
Separator
Use the separator variant for a labelled divider, such as a date or a
section break, in a conversation.
Border
The border variant keeps the default layout and draws a hairline under the
row, which sets it apart from the row that follows.
With icon
Use MarkerIcon to render an icon beside the content. To stack the icon above
the content, pass flexDirection: "column" through xstyle.
Links and buttons
Turn a marker into a link or a button with render. A marker rendered as an
a is underlined, and an a or button marker shows a pointer, turns to the
foreground colour on hover and shows a ring on keyboard focus. A link inside
MarkerContent is underlined and lights up on hover too.
Accessibility
Marker renders a plain div with no role, because the right semantics depend
on what the marker is for.
- Status and progress. For a marker that updates while work runs, such as
"Thinking…" or a running tool, pass
role="status"so assistive technology announces the change. - Labelled separators. A separator with text needs no role. Its lines are
hidden with
aria-hidden, and the label is read as ordinary content. - Decorative icons.
MarkerIconsetsaria-hidden, soMarkerContentcarries the meaning. A marker with only an icon still needs text: put it in aMarkerContentwithxstyle={states.srOnly}, which hides it visually. Anaria-labelon the marker is not read, because adivwith no role cannot be named. - Interactive markers. A marker that navigates or acts should render a real
aorbuttonthroughrender, so it is focusable and exposes the right role. Its accessible name comes from the marker text.
API reference
Pass render to replace a part's element or compose it with another component.
Every part also takes xstyle, className and style, which is real inline
CSS merged over the compiled styles.
Marker
Renders a div. With variant="separator" it renders a hidden line, styled
with separatorStyles from Separator, before and
after its children.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "border" | "separator" | "default" |
MarkerIcon
Renders a span with aria-hidden, sized by --arene-icon-size.
MarkerContent
Renders a span that wraps long words rather than overflowing.
markerStyles
The style map behind the component, exported so you can apply the same styles to any element.
| Key | Description |
|---|---|
base | The row, muted text, link and hover styles, and the focus ring |
variants | One entry per variant, keyed by its name |
icon | The icon box |
content | The content's wrapping |
Data attributes
| Attribute | On | Effect |
|---|---|---|
data-slot="marker" | the root | Targets the marker |
data-variant | the root | Reflects the variant prop |
data-slot="marker-icon" | the icon | Targets the icon box |
data-slot="marker-content" | the content | Targets the text |
CSS variables
| Variable | On | Effect |
|---|---|---|
--arene-icon-size | the root | The icon size, 1rem. Set it with style on Marker |
Cast the object to CSSProperties, as Sidebar
does. xstyle rejects a StyleX entry that sets only custom properties.