Skip to content

Video player settings

Pro

A video player's settings: a small panel over the picture at the player's corner whose rows open pages in its place (speed, captions, quality), a bottom sheet on phones. Not an M3 component (@windmorph/react-pro).

import { VideoPlayerSettings, VideoPlayerSettingsTrigger, VideoPlayerSettingsItem, VideoPlayerSettingsSwitch, VideoPlayerSettingsChoice, VideoPlayerSettingsSpeed, VideoPlayerSettingsPage } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Props

By name or description, across the 104 props below

VideoPlayerSettings 23 props

  • opentype boolean

    Whether it is open (controlled), for use without a trigger or a player.

  • defaultOpentype booleandefault false

    Whether it starts open (uncontrolled).

  • pagetype string | null

    The page on show: a row's id, null for the first page (controlled).

  • defaultPagetype string | nulldefault null

    The page at first (uncontrolled).

  • containertype HTMLElement | null

    The element to open in and stay within (positioned). In a player's slot, the player.

  • presentationtype "auto" | "panel" | "sheet"default "auto"

    A panel over the picture, or the same pages in a bottom sheet in the theme's colours. auto is a sheet in a window under 600px, decided as it opens.

  • placementtype "bottom-end" | "bottom-start" | "top-end" | "top-start"default "bottom-end"

    The container's corner it sits at.

  • defaultRowstype booleandefault true

    In a player's slot, the rows the player can fill (Playback speed, Captions, Loop…) come first; false drops them. A function as children places them instead.

  • backIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces the header's chevron_left.

  • forwardIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces a row's chevron_right toward its page.

  • checkIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces a choice's check.

  • childrentype ReactNode | ((rows: VideoPlayerSettingsDefaultRows) => ReactNode)

    Its rows: VideoPlayerSettingsItem, Switch, Choice, Speed, Page. As a function, it places the player's rows among its own, in the order it returns them; the player's rows it leaves out don't show (all null outside a player): {(rows) => <>{rows.loop}{rows.speed}<Quality />{rows.captions}</>}.

  • reftype Ref<HTMLDivElement>

    Ref to the panel.

  • idtype string

    The panel's id.

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when it opens or closes.

  • onClosedtype (() => void)

    Called once it has closed.

  • onPageChangetype ((page: string | null) => void)

    Called as the page changes.

Text

  • labelstype Partial<VideoPlayerSettingsLabels>

    Words it says, with English defaults. A LabelsProvider sets them for the whole app.

  • aria-labeltype stringdefault its button's: "Settings"

    The panel's name.

  • aria-labelledbytype string

    The id of what names the panel, in place of aria-label.

VideoPlayerSettingsTrigger 4 props

  • childrentype [ReactElement<unknown, string | JSXElementConstructor<any>>, ReactNode]Required

    The button first (a core Button or IconButton: it gets aria-haspopup, aria-expanded, aria-controls and data-open), then the VideoPlayerSettings.

  • opentype boolean

    Whether it is open (controlled).

  • defaultOpentype booleandefault false

    Whether it starts open (uncontrolled).

Events

  • onOpenChangetype ((open: boolean) => void)

    Called when it opens or closes.

VideoPlayerSettingsItem 14 props

  • labeltype stringRequired

    Its name.

  • closeOnActiontype booleandefault true

    Closes the settings after the action, as a menu's action does.

  • idtype string

    The row's id: its page's id, for page and onPageChange.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Its icon, in the leading column.

  • valuetype string

    What is chosen, at its end ("Auto (720p)").

  • descriptiontype string

    A second line, muted.

  • badgetype ReactNode

    A mark after the label ("HD"), drawn by the app; text is read after the label ("1080p HD").

  • badgeLabeltype stringdefault the badge's text

    What a badge that isn't text is read as, after the label.

  • textValuetype stringdefault label

    The text the first-letter search reads, where the label isn't plain text.

  • disabledtype boolean

    Can't be pressed.

  • reftype Ref<HTMLDivElement>

    Ref to the row.

Events

  • onActiontype (() => void)

    What a press does.

VideoPlayerSettingsSwitch 14 props

  • labeltype stringRequired

    Its name.

  • selectedtype boolean

    Whether it is on (controlled).

  • defaultSelectedtype booleandefault false

    Whether it starts on (uncontrolled).

  • reftype Ref<HTMLDivElement>

    Ref to the row.

  • idtype string

    The row's id: its page's id, for page and onPageChange.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Its icon, in the leading column.

  • descriptiontype string

    A second line, muted.

  • badgetype ReactNode

    A mark after the label ("HD"), drawn by the app; text is read after the label ("1080p HD").

  • badgeLabeltype stringdefault the badge's text

    What a badge that isn't text is read as, after the label.

  • textValuetype stringdefault label

    The text the first-letter search reads, where the label isn't plain text.

  • disabledtype boolean

    Can't be pressed.

Events

  • onChangetype ((selected: boolean) => void)

    Called when it is switched.

VideoPlayerSettingsChoice 17 props

  • optionstype readonly VideoPlayerSettingsOption<V>[]Required

    The options its page lists.

  • labeltype stringRequired

    Its name.

  • valuetype string

    The chosen option (controlled).

  • defaultValuetype string

    The option at first (uncontrolled).

  • valueLabeltype string

    The row's value where it isn't the chosen option's label ("Auto (720p)" for Auto).

  • afterSelecttype "close" | "back"default "close"

    A choice closes the settings (at once), or goes back to the first page.

  • reftype Ref<HTMLDivElement>

    Ref to the row.

  • idtype string

    The row's id: its page's id, for page and onPageChange.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Its icon, in the leading column.

  • descriptiontype string

    A second line, muted.

  • badgetype ReactNode

    A mark after the label ("HD"), drawn by the app; text is read after the label ("1080p HD").

  • badgeLabeltype stringdefault the badge's text

    What a badge that isn't text is read as, after the label.

  • textValuetype stringdefault label

    The text the first-letter search reads, where the label isn't plain text.

  • disabledtype boolean

    Can't be pressed.

Events

  • onChangetype ((value: V) => void)

    Called when an option is chosen.

VideoPlayerSettingsSpeed 19 props

  • idtype stringdefault "speed"

    The row's id, the page's.

  • valuetype number

    The speed (controlled).

  • defaultValuetype numberdefault 1

    The speed at first (uncontrolled).

  • mintype numberdefault 0.25

    The slowest.

  • maxtype numberdefault 2

    The fastest.

  • steptype numberdefault 0.05

    The slider's and Slower and Faster's step.

  • pageSteptype numberdefault 0.25

    Page Up and Page Down.

  • presetstype readonly (number | VideoPlayerSettingsSpeedPreset)[]default 1, 1.25, 1.5, 2

    A press away; the count is the app's and must fit the row.

  • labeltype stringdefault labels.speed, "Playback speed"

    The row's label, the page's title and the slider's name.

  • formatValuetype ((speed: number) => string)

    A speed in words, in place of the labels' "Normal" and "1.5×": the row's value, the slider's words and what Slower and Faster say.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>default Material Symbols speed

    The row's icon.

  • slowerIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces Slower's remove.

  • fasterIcontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Replaces Faster's add.

  • reftype Ref<HTMLDivElement>

    Ref to the row.

Events

  • onChangetype ((speed: number) => void)

    Called as the speed changes.

  • onPresetPresstype ((preset: VideoPlayerSettingsSpeedPreset) => void)

    Called when a preset is pressed, a disabled one included.

Text

  • labelstype Partial<VideoPlayerSettingsSpeedLabels>

    Words it says. A LabelsProvider sets them for the whole app.

VideoPlayerSettingsPage 13 props

  • childrentype ReactNodeRequired

    The page's own content, under the same header.

  • labeltype stringRequired

    Its name.

  • idtype string

    The row's id: its page's id, for page and onPageChange.

  • icontype ReactElement<unknown, string | JSXElementConstructor<any>>

    Its icon, in the leading column.

  • valuetype string

    What is chosen, at its end ("Auto (720p)").

  • descriptiontype string

    A second line, muted.

  • badgetype ReactNode

    A mark after the label ("HD"), drawn by the app; text is read after the label ("1080p HD").

  • badgeLabeltype stringdefault the badge's text

    What a badge that isn't text is read as, after the label.

  • textValuetype stringdefault label

    The text the first-letter search reads, where the label isn't plain text.

  • disabledtype boolean

    Can't be pressed.

  • reftype Ref<HTMLDivElement>

    Ref to the row.

Types

VideoPlayerSettingsOption 6 fields

One option of a VideoPlayerSettingsChoice.

  • valuetype VRequired
  • labeltype stringRequired
  • descriptiontype string
  • badgetype string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>

    A mark after the label ("HD"); text is read after the label ("1080p HD").

  • badgeLabeltype stringdefault the badge's text

    What a badge that isn't text is read as.

  • disabledtype boolean

VideoPlayerSettingsSpeedPreset 4 fields

A preset: a speed a press away, with an optional caption under it and a leading mark.

  • valuetype numberRequired
  • captiontype string

    Under the preset ("Normal" under 1 by default).

  • leadingtype string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<AwaitedReactNode>

    Before the figure: an app's mark (a locked speed's badge); name it if it means something.

  • disabledtype boolean

    Doesn't change the speed: onPresetPress tells the app (a locked speed).

Spec status

Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.

  • In a player's settings slot, with the rows the player fills

    Built

    Use case · Slot

  • The player's rows placed among yours (children as a function)

    Built

    Configuration · Slot

  • Badges on a row and its options (badge, badgeLabel)

    Built

    Configuration · Slot

  • A choice page (VideoPlayerSettingsChoice)

    Built

    Configuration · Slot, Alone

  • Alone, from your own button (VideoPlayerSettingsTrigger, container)

    Built

    Use case · Alone

  • The speed page, with a locked preset (VideoPlayerSettingsSpeed)

    Built

    Configuration · Alone

  • A switch, an action and a page of your own

    Built

    Configuration · Alone

  • Not an M3 component

    Extension

    M3’s menus open submenus beside the item and are modal; this panel’s pages take its place at the player’s corner and leave the video playing, with the core BottomSheet on phones.

  • Readable over any picture

    Extension

    Its fill (72% scrim) keeps every word at 4.5:1 over a white frame without the blur, a selected preset’s label included, in every theme and contrast level.

Theming & tokens

Set the tokens below on the settings or any ancestor. Its colours, fill, blur, state layers and focus ring default to the shared --wm-on-media-* tokens (on the Video player page), so one override reaches the player and its settings. The fill is 72% scrim and the quieter text 88%, the least that keep every word at 4.5:1 over a white frame, a selected preset's label included; the blur is extra, and under reduced transparency the fill is opaque. The speed's slider takes the --wm-media-slider-* tokens, and the sheet the core sheet's. The panel carries data-open while open. className goes on the panel; style each part with classNames: root, panel, sheet, scroller, page, header, back, title, divider, list, row, rowIcon, rowLabel, rowDescription, rowBadge, rowValue, rowArrow, check, switch, speed, speedValue, slider, slower, faster, presets, preset, presetLeading, presetCaption.

VideoPlayerSettings tokens
VariableDefaultPaints
--wm-video-player-settings-container-colorcolor-mix(in srgb, var(--md-sys-color-scrim) 72%, transparent)The panel’s see-through ground: the least that keeps every word, a preset’s label on its fill included, at 4.5:1 over a white picture (`settings-contrast.test.ts`); the blur and its opaque fallback are the on-media ones.
--wm-video-player-settings-width320pxThe panel’s width, the same on every page (never wider than its container allows).
--wm-video-player-settings-cornervar(--md-sys-shape-corner-medium)The panel’s corners.
--wm-video-player-settings-padding-bottom12pxThe space under a list’s last row.
--wm-video-player-settings-inset-end12pxThe panel’s distance from its container’s end edge (a player sets its own).
--wm-video-player-settings-inset-bottom12pxThe panel’s distance from its container’s foot (a player puts it over its controls).
--wm-video-player-settings-inset-top12pxThe least room above the panel: a taller page scrolls inside.
--wm-video-player-settings-header-height56pxA page’s header, its back row and title, above its divider: its state layer and the space above and below it.
--wm-video-player-settings-header-layer-inset4pxHow far a page header’s state layer sits in from the header’s top and foot, as a row’s does, so its corners never meet the panel’s.
--wm-video-player-settings-back-inset16pxThe back mark’s 24px box, from the panel’s start edge: over the rows’ icons.
--wm-video-player-settings-title-inset64pxWhere a page’s title starts, from the panel’s start edge: over the rows’ labels.
--wm-video-player-settings-divider-colorcolor-mix(in srgb, var(--md-sys-color-on-surface) 20%, transparent)The full-width hairline under a page’s header.
--wm-video-player-settings-row-height48pxA row’s least height (it grows for a second line or larger text).
--wm-video-player-settings-text-inset64pxWhere a row’s text starts, from the panel’s start edge, leaving the icon’s column: the icon 8px inside the row’s state layer.
--wm-video-player-settings-row-layer-inset8pxHow far a row’s state layer sits in from the panel’s sides.
--wm-video-player-settings-row-layer-cornervar(--md-sys-shape-corner-small)A row’s state layer’s corners.
--wm-video-player-settings-muted-colorcolor-mix(in srgb, var(--md-sys-color-on-surface) 88%, transparent)A second line, a row’s value and a preset’s caption: only as dim as 4.5:1 over a white picture allows.
--wm-video-player-settings-speed-padding-top24pxThe speed page’s space above its value.
--wm-video-player-settings-speed-padding-inline16pxThe speed page’s sides.
--wm-video-player-settings-speed-padding-bottom16pxThe speed page’s space under its presets.
--wm-video-player-settings-speed-gap24pxThe space between the value, the slider’s row and the presets.
--wm-video-player-settings-button-gap16pxThe space between Slower and Faster and the slider.
--wm-video-player-settings-preset-height32pxA preset’s height.
--wm-video-player-settings-preset-gap8pxThe space between presets.
--wm-video-player-settings-preset-colorcolor-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent)A preset’s see-through fill; Slower and Faster take it too.
--wm-video-player-settings-preset-selected-colorcolor-mix(in srgb, var(--md-sys-color-on-surface) 18%, transparent)The preset at the current speed: a deeper fill (no deeper than keeps its label at 4.5:1 over a white picture), with an emphasized label.
--wm-video-player-settings-caption-gap4pxThe space between a preset and its caption.
--wm-video-player-settings-fade-durationvar(--md-sys-motion-duration-short-1)The panel’s fade as it opens and closes (a choice closes it with none).
--wm-video-player-settings-page-durationvar(--md-sys-motion-duration-short-3)How long a page takes to slide in and the height to follow (at once under reduced motion).
--wm-video-player-settings-easingvar(--md-sys-motion-easing-standard)The easing of the fade, the slide and the height.
--wm-video-player-settings-back-size24pxThe back mark in a page’s header.
--wm-video-player-settings-divider-thickness1pxThe hairline under a page’s header.
--wm-video-player-settings-row-gap24pxThe space between a row’s icon and its text.
--wm-video-player-settings-icon-size24pxA row’s icon, and the column it sits in.
--wm-video-player-settings-preset-cornervar(--md-sys-shape-corner-full)A speed preset’s corners.