Audio foundations
What @sdxc/ui/audio is for, the rules its parts share, and every variable it reads.
The parts of a music app: a track table, artwork tiles, a player bar with its phone mini player, a queue and the playing mark.
They draw; a player drives them with the play queue and Media Session helpers the namespace ships beside them.
import "@sdxc/ui/theme.css";
import { … } from "@sdxc/ui/audio";When to reach for it
- An album, playlist or artist page whose tracks play from a table.
- A player bar that stays mounted while the rest of the app swaps beneath it.
- Lock-screen and media-key controls for any page that plays audio.
Shared ideas
- Outside the frameMount the bar beside the swapped
mainframe, so navigating never restarts the music. - Rows play
TrackList.PlayButtoncovers its row, so a press anywhere on it plays the track. - One markThe playing row is
aria-current="true"; any[data-audio-paused]ancestor stills everyEqualizer. - Queue as data
createPlayQueueand friends return new queues; shuffle keeps the playing track first. - System controls
syncMediaSessionpublishes the track and routes media keys back to the player. - Thumb-sizedUnder a coarse pointer the buttons reach the target size and the ranges grow tall.
CSS variables
Every custom property the namespace reads or declares, with its default and what it controls.
Reads the neutral role for text, hairlines and washes, and brand for the playing row, toggles that are on and a slider under the pointer. The roles are documented on Theming.
Shape and fill
None is declared in theme.css; set any of them on a part or an ancestor.
| Variable | Default | What it controls |
|---|---|---|
--ui-media-tile-radius | var(--ui-radius-md, 0.375rem) | Corner of a square tile's art. |
--ui-player-bar-fill | var(--ui-neutral-fg-emphasis) | The played part of the seek and volume ranges. |
--ui-player-bar-track | color-mix(in oklch, currentColor 22%, transparent) | The unplayed part of a range. |
--ui-player-bar-mini-bg | a mix of the raised surface and the brand | The phone mini player's card. |