collaboration — wyrd.component.comment-anchor

CommentAnchor

Compact anchored comment marker that opens an inline threaded discussion surface.

Install @wyrd-company/react or the Flutter package and use it directly — your DESIGN.md does the styling.

01

Examples

Generated from the contract's examples block. Previews are the published @wyrd-company/react component, themed by the brand's role tokens — flip the site's light/dark toggle and they follow.

Code target Applies to every example on component pages.
closed state: closed
Usage
import { WyrdCommentAnchor } from "@wyrd-company/react";

<WyrdCommentAnchor threadId="thread-route-delay" label="Comments on delay copy" commentCount={1} status="open" defaultOpen={false} comments={[{"id":"comment-route-delay-copy","author-id":"author-rin","author-name":"Rin","timestamp":"2026-07-04T16:15:00.000Z","body-format":"plain-text","body":"Delay copy should identify the affected service window before dispatch signs off.","decision":"request-changes","edited":false,"can-edit":false,"can-delete":false}]} />

// events: onOpenChange, onReplyChange, onReplySubmit, onResolve, onReopen, onCommentEdit, onCommentDelete
open state: open
Usage
import { WyrdCommentAnchor } from "@wyrd-company/react";

<WyrdCommentAnchor threadId="thread-coordinator-lock" label="Comments on coordinator field" commentCount={2} status="resolved" defaultOpen placement="margin" comments={[{"id":"comment-coordinator-lock","author-id":"author-mara","author-name":"Mara","timestamp":"2026-07-04T16:20:00.000Z","body-format":"plain-text","body":"Locked coordinator field matches this scenario.","decision":"approve","edited":true,"can-edit":true,"can-delete":false}]} />

// events: onOpenChange, onReplyChange, onReplySubmit, onResolve, onReopen, onCommentEdit, onCommentDelete
02

Properties

NameTypeDefaultSummary
thread-id string undefined Opaque host-supplied thread identifier represented by the marker.
label string undefined Accessible marker label supplied by the host for the anchor target.
comment-count integer 0 Number of comments represented by the marker.
status open | resolved open Host-supplied thread status.
is-open boolean undefined Controlled expansion state.
default-open boolean false Initial uncontrolled expansion state.
placement inline | block | margin margin Preferred visual placement for the expanded thread surface.
comments array Flat ordered comments for the expanded thread.
reply-value string undefined Controlled reply composer value for the expanded thread.
default-reply-value string Initial uncontrolled reply composer value.
can-reply boolean true Shows the reply composer in the expanded thread when true.
can-resolve boolean true Shows resolve/reopen affordance in the expanded thread when true.
03

Slots & events

EventPayloadSummary
open-change thread-id, is-open, reason Emitted when marker expansion changes.
reply-change thread-id, value Re-emitted from the expanded thread reply composer.
reply-submit thread-id, body Re-emitted when the expanded thread submits a reply.
resolve thread-id Re-emitted when the expanded thread requests resolving.
reopen thread-id Re-emitted when the expanded thread requests reopening.
comment-edit thread-id, comment-id Re-emitted when a child comment edit affordance is activated.
comment-delete thread-id, comment-id Re-emitted when a child comment delete affordance is activated.
04

Tokens

The contract's token bindings. Open the shared contextual sidebar from any example; primary swatches reflect the color you pick there. Error swatches show the active preset's values; editing any knob switches to custom and resets error to TWW · Ink.

BindingToken
marker-background color.primary
marker-foreground color.on-primary
resolved-background color.surface-container
resolved-foreground color.on-surface-variant
surface-background color.surface
surface-foreground color.on-surface
border-color color.outline
radius rounded.md
shadow shadow.md
padding-x spacing.sm
padding-y spacing.xs
gap spacing.sm
05

States

StateSourceSummary
closed property Marker is collapsed.
open property Expanded thread is visible.
resolved property Marker represents a resolved thread.
06

Accessibility

From the contract's accessibility obligations. Role button; Label property and comment count are combined through the localized marker label.

  • Tab moves focus to the marker, close button, and expanded thread controls.
  • Enter or Space toggles the marker when focused.
  • Escape closes the expanded thread and restores focus to the marker.
  • The marker is a button with aria-expanded reflecting open state.
  • The expanded thread is a non-modal inline/anchored surface, not a focus trap.
  • The close control is a button named by component-owned localized text.
  • The expanded thread preserves CommentThread native list semantics.
  • Verified under: rtl, reduced-motion, cvd-deuteranopia, density-compact, text-expansion.
07

SDUI

Status: serializable. CommentAnchor serializes marker state, flat comments, and interaction bindings for embeddable host surfaces. Host-owned persistence and anchor storage are outside the component.

SerializableMembers
Propertiesthread-id, label, comment-count, status, is-open, default-open, placement, comments, reply-value, default-reply-value, can-reply, can-resolve
Slots
Eventsopen-change, reply-change, reply-submit, resolve, reopen, comment-edit, comment-delete
The Wyrding Way — a contract-first design system. © Wyrd Company