Duration tag
ProA video's length in the corner of its picture, light on a dark see-through ground over any picture, read in words as part of the card's link. Not an M3 component (@windmorph/react-pro).
import { DurationTag, MediaFrame } 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
DurationTag 11 props
The media's length in seconds (whole seconds, rounded down). Not finite or negative: nothing is drawn.
Lifts it clear of something along the picture's foot, such as a progress line.
Which corner of its
MediaFrame(or any one-cell grid) it sits in;noneleaves it in the flow, for an app that places it.What assistive technology reads in place of the default ("Length 4 minutes, 12 seconds").
Replaces the clock ("4:12"); given the seconds and the page's locale.
Ref to the tag.
The tag's id.
Text
Words it says, with English defaults. A
LabelsProvidersets them for the whole app.
Classes for the tag. Wins over the defaults via
cn().Classes for each part.
Inline styles for the tag, e.g.
--wm-duration-tag-*tokens.
MediaFrame 6 props
The frame's shape, e.g.
16/9; left out, its size is the app's.The picture (or video), then what lies over it, the
DurationTaglast.Ref to the frame.
The frame's id.
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.
| Item | Status | Details |
|---|---|---|
| A length on a card that is a link, read in words as part of its name | Built | Use case · Card |
Raised clear of a progress line (raised) | Built | Configuration · Options |
Corners (placement) and a rounder frame (--wm-media-frame-corner) | Built | Configuration · Options |
Your own words and clock (label, formatDuration) | Built | Configuration · Options |
| Not an M3 component | Extension | M3 has no length tag; the core list’s video item draws the same look for its own length, from the same formatters in the core’s primitives. |
| One look in every mode | Extension | The clock is the theme’s light neutral on scrim at 72% in light and dark mode alike, so it keeps 4.5:1 over a white picture without a theme scope of its own. |
A length on a card that is a link, read in words as part of its name
BuiltUse case · Card
Raised clear of a progress line (
Builtraised)Configuration · Options
Corners (
Builtplacement) and a rounder frame (--wm-media-frame-corner)Configuration · Options
Your own words and clock (
Builtlabel,formatDuration)Configuration · Options
Not an M3 component
ExtensionM3 has no length tag; the core list’s video item draws the same look for its own length, from the same formatters in the core’s primitives.
One look in every mode
ExtensionThe clock is the theme’s light neutral on
scrimat 72% in light and dark mode alike, so it keeps 4.5:1 over a white picture without a theme scope of its own.
Theming & tokens
Set the tokens below on the tag, its frame or any ancestor. The tag is a dark ThemeScope, so its clock is the dark theme's on-surface in every mode, in a theme made at run time too, on scrim at 72%, which keeps 4.5:1 over a white picture in every theme and contrast level. className goes on the tag; style each part with classNames: root, label, clock.
| Variable | Default | Paints |
|---|---|---|
--wm-duration-tag-container-color | color-mix(in srgb, var(--md-sys-color-scrim) 72%, transparent) | The ground, the same in both modes: at 72% the text keeps 4.5:1 over a white picture (under about 60% it doesn’t). |
--wm-duration-tag-content-color | var(--md-sys-color-on-surface) | The clock: the dark theme’s `on-surface` (the tag is a dark scope), light in every mode. |
--wm-duration-tag-corner | var(--md-sys-shape-corner-extra-small) | The tag’s corners. |
--wm-duration-tag-padding-inline | 4px | The space at each side of the clock. |
--wm-duration-tag-inset | var(--_wm-duration-tag-frame-inset, 4px) | The distance from the picture’s edges: inside a `MediaFrame`, the least that clears its corners; otherwise 4px. |
--wm-duration-tag-raised-inset | 8px | The foot’s distance when `raised`, clear of a progress line along the picture. |
| Variable | Default | Paints |
|---|---|---|
--wm-media-frame-corner | var(--md-sys-shape-corner-medium) | The frame’s corners, which it paints and from which it works out how far in a tag must sit to clear the curve. |