Skip to content

Component Reference

The AS Community UI layer is built from standard custom elements. In most integrations you only need <asc-comment-widget>, but the lower-level components are available when you want to compose your own flow.

Overview

TagPurpose
asc-comment-widgetFull comment widget with data loading and tenant-config handling
asc-comment-listPaginated list shell for top-level comments
asc-comment-itemSingle comment row with reply/edit/delete actions
asc-comment-formNew/edit/reply textarea form
asc-vote-buttonsVote controls with optimistic UI hooks
asc-reply-listLazy-loaded reply thread shell

asc-comment-widget

Use this for the default integration. It owns comment loading, reply loading, voting, editing, deletion, and sort changes internally.

Attributes

AttributeTypeDescription
article-idstringArticle identifier for all requests
tenant-idstringTenant identifier used for config and API requests
api-base-urlstringBase URL for comment API calls
config-base-urlstringOptional separate base URL for GET /tenants/{tenantId}
theme-urlstringOptional JSON file of CSS variable overrides
fcm-tokenstringOptional token forwarded on write requests
sort'new' | 'score' | 'controversial'Initial sort preference
inspect-modebooleanEnables token-inspection events for studio tooling

JS Properties

PropertyTypeDescription
tenantConfigTenantConfig | nullAssign a full tenant config object directly

Events

The widget does not re-emit comment lifecycle events to the host page. It only exposes inspection events:

EventDetail
asc-inspect-hover{ tokens, label, rect } | null
asc-inspect-select{ tokens, label, rect }

Notes

  • Feature flags and behavior come from tenantConfig.features and tenantConfig.behavior, not custom HTML attributes such as show-voting or max-depth.
  • If both theme-url and tenantConfig.theme are provided, theme-url wins because the widget fetches and applies it explicitly.

asc-comment-form

Attributes

AttributeType
context'new' | 'edit' | 'reply'
parent-idstring | null
initial-contentstring
comment-idstring
max-lengthnumber
show-cancelboolean

Events

EventDetail
asc-comment-submit{ context, content, parentId, commentId }
asc-comment-cancel{}

Methods

  • markSubmitSuccess()
  • markSubmitError(message: string)

asc-comment-item

JS Properties

PropertyType
commentComment | null
userVote'up' | 'down' | ''
editingboolean
allowVotingboolean
allowRepliesboolean
allowEditboolean
allowDeleteboolean
showModerationStatusboolean
maxLengthnumber

Events

EventDetail
asc-comment-edit{ commentId: string }
asc-comment-delete{ commentId: string }
asc-comment-reply{ commentId: string; depth: number }

asc-comment-list

JS Properties

PropertyType
commentsComment[]
userVotesRecord<string, 'up' | 'down' | null>
isLoadingboolean
hasErrorboolean
errorMessagestring
hasNextPageboolean
isLoadingMoreboolean

Events

  • asc-load-more
  • asc-retry

asc-vote-buttons

Attributes

AttributeType
comment-idstring
up-countnumber
down-countnumber
user-vote'up' | 'down' | ''

Events and Methods

  • asc-vote-change with { commentId, direction }
  • markVoteComplete()

asc-reply-list

Attributes / Properties

NameType
parent-idstring
reply-countnumber
has-next-pageboolean
repliesComment[]
userVotesRecord<string, 'up' | 'down' | null>

Events and Methods

  • asc-load-replies with { commentId }
  • markRepliesLoaded()