MediaVolumeControl
Mute / unmute toggle button with a vertical volume scrubber shown in a tooltip on hover.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-media-volume-control> — 4 internal parts: the tooltip wrapper ①, the icon-only toggle button ②, the tooltip volume wrapper ③, and the vertical scrubber ④.- 1.origam-media-volume-control__btn
- Icon-only
<button>that triggers mute/unmute. Styled withall: unsetand rounded withborder-radius: 50%. - 2.origam-icon (within __btn)
- Volume icon that switches between VOLUME_OFF / VOLUME_LOW / VOLUME_MEDIUM / VOLUME_HIGH based on
volumeandmuted. - 3.origam-media-volume-control__wrapper
- Container inside the tooltip — 14 × 80 px — that hosts the vertical scrubber.
- 4.origam-media-volume-control__scrubber
<origam-media-scrubber>in vertical orientation.max=1,step=0.05. Collapses to 0 when muted.
API
Props
All props accepted by this component, with their type, default value and description.
- volumerequirednumber—
- Linear volume in [0, 1]. Drives the scrubber position and the volume icon tier.
- mutedrequiredboolean—
- When true, collapses the scrubber to 0 and shows the VOLUME_OFF icon.
- muteLabelrequiredstring—
- aria-label on the toggle button when the media is NOT muted (clicking will mute). Must be pre-translated.
- unmuteLabelrequiredstring—
- aria-label on the toggle button when the media IS muted (clicking will unmute). Must be pre-translated.
- volumeLabelrequiredstring—
- aria-label rendered on the vertical scrubber inside the tooltip. Must be pre-translated.
- dataCystring'origam-media-volume-control'
- data-cy prefix used on the toggle button. The wrapper and scrubber derive their own selectors via convention.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- colorTColor
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- sizeTSize | number
- densityTDensity
API
Emits
Events emitted by this component.
- @update:mutedboolean
- Fired when the mute toggle is clicked. Payload is the proposed new muted state (!muted).
- @update:volumenumber
- Fired when the vertical scrubber moves. Payload is the new linear volume in [0, 1].
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Width and height of the toggle button.
- Border radius of the toggle button (full circle by default).
- Foreground color of the icon button.
- Background color on hover and focus-visible.
- Font-size of the volume icon inside the button.
- Background color of the tooltip content area containing the scrubber.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Enter / Space | Toggles mute/unmute on the icon button. |
| Arrow Up / Arrow Down | Adjusts volume via the vertical scrubber (step 0.05). |
| Tab | Moves focus between the toggle button and the scrubber inside the tooltip. |
Notes
- The toggle button's aria-label switches between muteLabel and unmuteLabel to reflect the current state.
- The scrubber exposes aria-label (volumeLabel) and aria-valuetext (formatted percentage) for screen readers.
- The button scale transform on :active is the only animation — it respects prefers-reduced-motion by being a short (120ms) transition.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic usage
Ecosystem
Family
Components from the same folder that share conventions and often compose together.