MediaVolumeControl
Mute / unmute toggle button with a vertical volume scrubber shown in a tooltip on hover.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- volumerequisnumber—
- Linear volume in [0, 1]. Drives the scrubber position and the volume icon tier.
- mutedrequisboolean—
- When true, collapses the scrubber to 0 and shows the VOLUME_OFF icon.
- muteLabelrequisstring—
- aria-label on the toggle button when the media is NOT muted (clicking will mute). Must be pre-translated.
- unmuteLabelrequisstring—
- aria-label on the toggle button when the media IS muted (clicking will unmute). Must be pre-translated.
- volumeLabelrequisstring—
- 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
Événements émis par ce composant.
- @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].
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | 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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic usage
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.