Documentation
Browse documentation

DocumentationReference

Elements and attributes

The view of a PlayerVox OverCrow widget is made of a closed set of elements. This page lists each one with its content, its attributes and the events it can send. The view explains the markup around them: expressions, if, for, components.

OCMLtemplates/chart/view.ocml
<box class="panel">
  <box class="header">
    <text class="title">{t("title")}</text>
    <text class="value">{latest(state.values)}</text>
  </box>
  <chart class="plot" kind="area" min="0" max="100">
    <series class="series" values={state.values}/>
  </chart>
</box>

Two box containers, two text elements bound to the state, and a chart with one series: PlayerVox OverCrow draws all of it, the chart included.

How to read an element

  • Content is what the element may hold: flow is any element that can stand on its own in a container (all but span, option and series); inline is the content of a text; text is plain text; empty means the element is written <name …/>.
  • Parents says where the element may be: any flow is any container.
  • Keyboard focus: always for controls; when subscribed for an element that takes the focus only when the view listens to one of its events (on:activate…); never otherwise.
  • Role is what assistive technology is told the element is.
  • Events are the events the view may listen to with on:<event>.

A type such as "text ≤ 256 bytes" gives a limit.

Attributes of every element

AttributeTypeRequiredMeaning
classclass listnoStyle classes: distinct names separated by one space.
refstatic ref namenoName by which draw designates this canvas and by which an attribute such as the anchor of a popover designates this element. Static, unique in the view, and not allowed inside a for or a component body, where it would name several elements.
labeltext ≤ 256 bytesnoAccessible name; required on icon-only controls.
tooltiptext ≤ 256 bytesnoPlain text drawn by the host on hover or focus.
onsorted event namesnoEvents forwarded to the logic; written on:<event> in the view.

Elements

box

Generic container; flex or grid layout comes from style. The root of the view is a box.

ContentParentsKeyboard focusRoleEvents
flowany flowwhen subscribedgroupactivate, contextmenu, wheel, keydown, focus, blur

No attribute of its own.

scroll

Clipping container scrolled by the host with wheel, drag and keyboard.

ContentParentsKeyboard focusRoleEvents
flowany flowneverscroll-viewreachend, stick, contextmenu
AttributeTypeRequiredMeaning
axisvertical | horizontalnoScroll direction; default vertical.
stick-to-endbooleannoStay at the end while content grows, until the user scrolls away (chat). Setting it again after it was off scrolls to the end.

list

Vertical scrolling list whose children are laid out and painted only when visible.

ContentParentsKeyboard focusRoleEvents
flowany flowneverlistreachend, stick, contextmenu
AttributeTypeRequiredMeaning
stick-to-endbooleannoAs for scroll.
item-heightinteger 1 to 4096noEstimated child height used before a child is first measured.

text

Block of wrapped text; its inline children flow with it (chat line with emotes).

ContentParentsKeyboard focusRoleEvents
inline: span, icon, imageany flowwhen subscribedlabelactivate, contextmenu, wheel, keydown, focus, blur
AttributeTypeRequiredMeaning
selectablebooleannoThe user can select the text and copy it through the host; no widget permission involved.

span

Styled run of text inside text.

ContentParentsKeyboard focusRoleEvents
texttextneverlabelnone
AttributeTypeRequiredMeaning
coloropaque #rrggbbnoColour from data, such as a chat author's; overrides the style colour, and the host raises its contrast to at least 4.5:1 against the panel.

icon

Lucide icon tinted with color, sized by font-size unless width and height are set.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedimageactivate, contextmenu, wheel, keydown, focus, blur
AttributeTypeRequiredMeaning
nameLucide icon nameyesIcon name, for example circle-check.

image

Raster image from the package, or an image handed by a service (an asset: handle); object-fit applies.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedimageactivate, contextmenu, wheel, keydown, focus, blur
AttributeTypeRequiredMeaning
srcimage sourceyesImage source.

avatar

Round image with a text fallback while the image is missing or failed.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedimageactivate, contextmenu, wheel, keydown, focus, blur
AttributeTypeRequiredMeaning
srcimage sourcenoImage source.
initialstext ≤ 16 bytesnoFallback text.

badge

Short pill of text.

ContentParentsKeyboard focusRoleEvents
textany flowwhen subscribedlabelactivate, contextmenu, wheel

No attribute of its own.

button

Activatable control; its children (icon, text) form its content.

ContentParentsKeyboard focusRoleEvents
flowany flowalwaysbuttonactivate, contextmenu, wheel, keydown, focus, blur
AttributeTypeRequiredMeaning
disabledbooleannoRejects input; matches :disabled.
submitbooleannoSubmits the enclosing form.

toggle

On/off switch.

ContentParentsKeyboard focusRoleEvents
emptyany flowalwaysswitchchange, focus, blur, contextmenu
AttributeTypeRequiredMeaning
checkedbooleannoState; matches :checked.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.

checkbox

Check control (checklists).

ContentParentsKeyboard focusRoleEvents
emptyany flowalwayscheck-boxchange, focus, blur, contextmenu
AttributeTypeRequiredMeaning
checkedbooleannoState; matches :checked.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.

slider

Numeric range control; dragging is handled by the host.

ContentParentsKeyboard focusRoleEvents
emptyany flowalwayssliderinput, change, focus, blur, contextmenu
AttributeTypeRequiredMeaning
minnumber -1000000000 to 1000000000yesLower bound.
maxnumber -1000000000 to 1000000000yesUpper bound, greater than min.
stepnumber -1000000000 to 1000000000noPositive increment; default 1.
valuenumber -1000000000 to 1000000000noCurrent value, clamped to the range; rejected on a slider bound to a write intent.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.

select

Drop-down choice; the open list is drawn by the host.

ContentParentsKeyboard focusRoleEvents
optionany flowalwayscombo-boxchange, focus, blur, contextmenu
AttributeTypeRequiredMeaning
valuetext ≤ 1 KiBnoSelected option value.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.

option

Choice of a select; its text is the visible label.

ContentParentsKeyboard focusRoleEvents
textselectneverlist-box-optionnone
AttributeTypeRequiredMeaning
valuetext ≤ 1 KiByesValue reported by change.
disabledbooleannoRejects input; matches :disabled.

field

Single-line text input edited by the host, input methods (IME) included.

ContentParentsKeyboard focusRoleEvents
emptyany flowalwaystext-inputinput, change, submit, keydown, focus, blur, contextmenu
AttributeTypeRequiredMeaning
valuetext ≤ 16 KiBnoReplaces the content; rejected on a field bound to a write intent.
placeholdertext ≤ 256 bytesnoHint shown while empty.
max-lengthinteger 1 to 16384noContent limit in bytes; a write intent may impose a lower one.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.
autofocusbooleannoTakes keyboard focus when the element appears while the logic handles a user action (an editor opened by a click), in Interactive mode, in the widget that received the action; the first such element of the view when several appear together. Never when the widget starts, from a timer or the answer of a service, in Passive mode, or when set on an element already shown.

textarea

Multi-line text input edited by the host, input methods (IME) included.

ContentParentsKeyboard focusRoleEvents
emptyany flowalwaysmultiline-text-inputinput, change, submit, keydown, focus, blur, contextmenu
AttributeTypeRequiredMeaning
valuetext ≤ 16 KiBnoAs for field.
placeholdertext ≤ 256 bytesnoHint shown while empty.
max-lengthinteger 1 to 16384noAs for field.
rowsinteger 1 to 40noVisible rows before scrolling; default 3.
disabledbooleannoRejects input; matches :disabled.
nameidentifier ≤ 64 bytesnoField name inside a form.
autofocusbooleannoTakes keyboard focus when the element appears while the logic handles a user action (an editor opened by a click), in Interactive mode, in the widget that received the action; the first such element of the view when several appear together. Never when the widget starts, from a timer or the answer of a service, in Passive mode, or when set on an element already shown.

form

Groups named controls. With intent, submitting sends their values to a write service directly from the host; the widget's logic never supplies that content.

ContentParentsKeyboard focusRoleEvents
flowany flowneverformsubmit
AttributeTypeRequiredMeaning
intentnotes.save | playervox.rating.publish | twitch.chat.sendnoBound write intent.
targettext ≤ 1 KiBnoOpaque ID of the edited object (note, reply parent), checked by the service.

elapsed

Duration text advanced by the host from an anchor given by a service, so a running stopwatch needs no work from the logic. Styled like text; repainted only when the shown text changes, at most at 60 Hz, and never while hidden.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedtimeractivate, contextmenu, wheel
AttributeTypeRequiredMeaning
baseinteger 0 to 9007199254740991yesElapsed milliseconds at at.
atinteger 0 to 9007199254740991yesHost monotonic milliseconds from the service result.
runningbooleannoAdvance from at; default false.
formathh:mm:ss | hh:mm:ss.cc | mm:ssyesHours grow past 99; cc are hundredths, truncated.

progress

Horizontal progress bar.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedprogress-indicatoractivate, contextmenu, wheel
AttributeTypeRequiredMeaning
valuenumber -1000000000 to 1000000000yesCurrent value.
maxnumber -1000000000 to 1000000000noPositive upper bound; default 1.

gauge

Ring or arc gauge.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedmeteractivate, contextmenu, wheel
AttributeTypeRequiredMeaning
valuenumber -1000000000 to 1000000000yesCurrent value.
maxnumber -1000000000 to 1000000000noPositive upper bound; default 1.
shapering | arcnoDefault ring.

chart

Line, area, bar or sparkline chart drawn by the host.

ContentParentsKeyboard focusRoleEvents
seriesany flowwhen subscribedfigureactivate, contextmenu, wheel
AttributeTypeRequiredMeaning
kindline | area | bar | sparklineyesChart type.
minnumber -1000000000 to 1000000000noFixed lower bound of the value axis.
maxnumber -1000000000 to 1000000000noFixed upper bound of the value axis.

series

One data series of a chart, coloured with color.

ContentParentsKeyboard focusRoleEvents
emptychartneverfigurenone
AttributeTypeRequiredMeaning
valuesnumber list ≤ 1024yesValues in order.

separator

Thin rule between groups.

ContentParentsKeyboard focusRoleEvents
emptyany flowneversplitternone
AttributeTypeRequiredMeaning
axisvertical | horizontalnoDefault horizontal.

canvas

Surface painted by the host from the latest list of commands given to draw.

ContentParentsKeyboard focusRoleEvents
emptyany flowwhen subscribedimageactivate, contextmenu, wheel, keydown, focus, blur

No attribute of its own.

popover

Floating panel anchored to an element, drawn above the content and clipped to the widget's frame (drop-downs, context menus).

ContentParentsKeyboard focusRoleEvents
flowany flownevermenudismiss
AttributeTypeRequiredMeaning
anchorref nameyesref of the element the panel is placed against.
openbooleannoVisibility; the host closes it and sends dismiss.
placementbelow | above | start | end | pointernoPreferred side, or the last pointer position; default below.

Events

EventUser actionDetailMeaning
activateyesx, yPrimary click, or Enter or Space on the focused element.
contextmenuyesx, ySecondary click, Menu key or Shift+F10.
wheelnodx, dyWheel or touchpad scroll over an element that is not a scroll container.
keydownyeskey, ctrl, alt, shift, meta, repeatKey pressed while the element has focus in Interactive mode. Keys reserved by the host (Tab traversal, OverCrow shortcuts, input method composition) are never delivered.
inputyesvalueValue edited (text, slider drag). Read-only copy; the host keeps the content.
changeyesvalueValue committed: blur or Enter for text, release for a slider, any change for toggle, checkbox and select.
submityesoutcome, errorForm submitted by Enter in a field, Ctrl+Enter in a field or textarea, or a submit button; a write intent may keep plain Enter for moving between its fields. With an intent, carries the outcome of the write.
focusnononeThe element gained keyboard focus.
blurnononeThe element lost keyboard focus.
reachendnononeScrolled within one viewport of the end (load more, history).
sticknostuckThe user scrolled a container away from its end, or back to it (unread count, return to the latest). Content growing never sends it.
dismissnononeThe host closed a popover (Escape, outside click, anchor removed).

An event marked as a user action allows a protected service call while the logic handles it. The detail is what a handler receives; in a handler written as a call, it is named event:

OCMLwidgets/twitch-chat/view.ocml
    <list class="history" stick-to-end={state.following} item-height="20" label={heading(state)} on:stick={stuck(event.stuck)}>

The named keys of keydown are:

Enter, Escape, Backspace, Delete, ArrowUp, ArrowDown, ArrowLeft, ArrowRight, Home, End, PageUp, PageDown.

Any other key is one printable character.

Default sizes

The elements that PlayerVox OverCrow draws take these sizes, in logical pixels at 100 %, unless the style sets width or height. Any other element is sized by its content and by the style: a canvas has no size until the style gives it one.

ElementWhenWidthHeight
iconalwaysfont-sizefont-size
imagealwaysdecoded image, else 0decoded image, else 0
avataralwaysdecoded image, else 28decoded image, else 28
togglealways3218
checkboxalways1616
slideralways12018
progressalways1206
gaugeshape="arc"4832
gaugealways4848
chartalways16048
fieldalways160max(--control-height, line height)
textareaalways160rows line heights
separatoraxis="vertical"10
separatoralways01
selectalwaysits textits text
elapsedalwaysits textits text
OCSSdocs/content/examples/countdown/style.ocss
.dots {
  height: 12px;
}