Skip to content

<mosaica-count>

A single formatted count.

Use <mosaica-count> when you build your own panel from the store's projections and want its counts to look like those of the other elements. It has no store, so you set its properties yourself.

A sample Count set in count shows as 4,812 of 12,465, the marks shown out of those served. A Masked count set in masked shows as one figure, marked ≈ when it is an estimate. When both are set, the element shows count. It shows nothing for an inexact sample, or for any count while stale is set.

import '@mosaicajs/components/count';

Attributes

Attribute Property Type Default Description
stale stale boolean false Shows nothing, for a count that is out of date because the data changed.
label label string '' Text rendered after the figure, such as matched.
figure figure 'both' | 'shown' 'both' both shows a sample as shown of total. shown shows the shown figure alone and puts the total in the count part's data-total.
compact compact boolean false Shortens figures of a thousand or more to one decimal, as 16.8M.

Properties

Set as JavaScript properties; they have no attribute.

Property Type Default Description
count Count | null null A sample count: how many marks are shown of how many are served.
masked Masked | null null A masked count over the items the viewer may see. Shown if count is not set.

Parts

Styled from outside the element with ::part().

Part Description
count The figure, with data-kind (sample, scalar or none), data-exact (true or false), data-empty (true if nothing is shown) and, with figure="shown", data-total.
label The label text after the figure, shown only with the figure.

CSS custom properties

The theme tokens apply to this element.