ZoomIndicator is a vertical pill — a filled bar above, an icon at the bottom — that reports the zoom level currently in effect for a camera or media view. Like its horizontal sibling VolumeIndicator, it exists for transient feedback: show it while the level moves, remove it once the interaction or command that changed it has settled.import { ZoomIndicator } from '@wearables-ui-toolkit/mrbd';
const FILL_HEIGHT = { height: '100%' } as const;
type Props = {
zoom: number;
maxZoom: number;
isAdjusting: boolean;
};
export function ZoomOverlay({ zoom, maxZoom, isAdjusting }: Props) {
if (!isAdjusting) {
return null;
}
return (
<div className="zoom-overlay">
<ZoomIndicator
value={zoom}
minimumValue={1}
maximumValue={maxZoom}
animated
style={FILL_HEIGHT}
aria-label="Camera zoom"
/>
</div>
);
}
.zoom-overlay {
position: absolute;
top: var(--uit-spacing-large);
bottom: var(--uit-spacing-large);
right: var(--uit-spacing-large);
display: flex;
align-items: stretch;
}
style is merged over the component’s own container styles, setting a height there is the reliable way to stretch it down the side of an overlay.import { ZoomIndicator } from '@wearables-ui-toolkit/mrbd';
type Props = {
magnification: number;
maxMagnification: number;
};
export function BareZoomTrack({ magnification, maxMagnification }: Props) {
return (
<ZoomIndicator
value={magnification}
minimumValue={1}
maximumValue={maxMagnification}
icon={null}
announceUpdatesForAccessibility
aria-label="Magnification"
/>
);
}
ZoomIndicatorProps, which extends HTMLAttributes<HTMLDivElement>.| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | Required. Current level. Clamped to the range before it is drawn and reported. |
minimumValue | number | 0 | Low end of the range, reported as aria-valuemin. |
maximumValue | number | 1 | High end of the range, reported as aria-valuemax. |
icon | IconSource \| null | circle-handle glyph | Icon shown at the bottom. Pass null to drop the icon area; the gap below the bar closes with it. undefined keeps the default glyph, so a conditional expression can fall back to it. |
animated | boolean | false | Tween value changes instead of snapping. Applies to every change while set. |
announceUpdatesForAccessibility | boolean | false | Publish the rounded percentage into a polite live region so screen readers narrate each change. |
aria-label | string | — | Appended after the percentage in the accessible name. Blank or whitespace-only labels are ignored. |
aria-labelledby | string | — | Id of external label text, applied to the progressbar element. It replaces the generated name outright, so the percentage is no longer part of it. |
aria-describedby | string | — | Id of additional description text, applied to the progressbar element. |
className | string | '' | Added to the root element. |
style | CSSProperties | {} | Merged onto the root element. |
aria-* attribute you pass is applied to the inner progressbar element, where it can take effect; every other DOM prop, including data-*, lands on the root. The component writes role, aria-valuenow, aria-valuemin, and aria-valuemax on that inner element last, so values you pass for those four are overwritten.[minimumValue, maximumValue], so an out-of-range reading never overdraws the bar. Set the range to the real zoom range rather than normalizing it yourself: the component reports your raw value through aria-valuenow and derives the percentage for the label, so a range that starts at the minimum magnification stays truthful. When the minimum and maximum are equal it reports 100%.icon={null} removes the icon area and the gap that separated it from the bar, while the pill’s vertical padding stays the same.--uit-color-background-elevation2 and fully rounded; the icon is tinted with --uit-color-icon-primary, and the bar’s filled portion uses --uit-color-control-active.icon takes any IconSource: an inline vector, a caller asset referenced by URL, or a plain URL string. The component owns the icon’s size and tint.animated unset, value changes apply immediately, which is usually right for a value the user is actively changing. Setting it applies a sampled spring transition to the fill and keeps applying it to every later change while it stays set.usePrefersReducedMotion and drop animated when the user has asked for less motion.role="progressbar" carrying aria-valuenow (the clamped value, in your units), aria-valuemin, and aria-valuemax. The drawn bar inside it is hidden from assistive technology, so the component contributes exactly one progressbar to the accessibility tree.aria-label the accessible name is just the rounded percentage, which says nothing about what is being scaled. Supply a label such as Camera zoom; it is appended after the percentage — 75%, Camera zoom. A label that is empty or only whitespace is ignored.announceUpdatesForAccessibility on publishes just the percentage into a polite, atomic live region that sits outside the progressbar element so the change is reliably picked up. Enable it only when the overlay is the sole feedback for the change.aria-labelledby when the naming text already exists on screen, and aria-describedby for supplementary detail; both are forwarded to the progressbar element.aria-label, since it has no default one.ZoomIndicator for the vertical pill instead of rotating or restyling a VolumeIndicator.