Design System

Design System

Video control button

Media

Open in Storybook: Video control button (opens in a new tab)

On this page

Overview

The control button is a native button with an icon, the one every control of the video bar is made of: Play/Pause, Mute, Captions, Audio description and Full screen. The name is its aria-label, because an icon is not a name.

It has no state of its own. Hover, focus and pressed are CSS, and pressed is aria-pressed, so what the screen reader says and what the eye sees cannot drift.

Live example

Anatomy

  1. Button

    button type="button" aria-label

    The name is its aria-label. A toggle has aria-pressed, and then the fill is lighter and a bar is drawn under the icon.

  2. Icon

    svg aria-hidden="true" focusable="false"

    One of nine, 20 × 20, in the colour of the button. It is never the name.

Usage

Props

Props
PropDoesDefault
iconOne of play, pause, captions, fullscreen, chevron-down, volume, muted, transcript, audio-descriptionRequired
labelThe name of the buttonRequired
pressedA toggle that is on or off. Left out, the button is a plain action and has no aria-pressedAbsent

Example

import { VideoControlButton } from '@/components/VideoControlButton'

<VideoControlButton icon="captions" label="Captions" pressed={on} onClick={toggle} />

Specs

Measurements

Measurements
PartPropertyValue
ButtonSize · corner44 × 44px (2.75rem) · 8px
IconSize20 × 20px
On indicatorSize · place20 × 3px, 2px corner · 36px from the top, 12px from the start
Focus ringWidth · offset3px · 0

States

States
StateFillOther
DefaultNone—
HoverWhite at 16%—
FocusNoneA 3px white ring, for a control on a dark bar
Pressed (on)White at 24%A 3px bar under the icon, in the colour of the icon

Tokens

Component tokens

Component tokens
PartPropertyTokenValue
ButtonHover fill—White at 16%
ButtonPressed fill—White at 24%
Icon, bar, ringColour—#ffffff. The control sits on a dark surface, so it is not a site colour
SurfaceFillink#16161a, the bar the control sits on

Guidelines

Rules

Rules
RuleWhy
Always on a dark surfaceThe ring and the fills are white. On a light surface they do not show
A name on every buttonAn icon is not a name. Play and Pause change the name; a toggle keeps it and changes aria-pressed
A toggle for on and off onlyA button that does something once has no aria-pressed

Accessibility

Keyboard

Keyboard
KeyActionNative
TabFocuses it, with a 3px white ringYes
Enter, SpaceActivates it. A toggle keeps its focusYes

WCAG criteria

WCAG criteria
CriterionLevelRequirement here
1.1.1 Non-text ContentAThe icon is aria-hidden; the name is the aria-label
1.4.11 Non-text ContrastAAWhite on ink, well over 3:1, for the icon, the ring and the bar
2.1.1 KeyboardAA native button
2.4.7 Focus VisibleAAA 3px white ring
2.5.8 Target Size (Minimum)AA44 × 44px
4.1.2 Name, Role, ValueAA button with a name, and aria-pressed for a toggle

Related

References

This section is still in progress.