shadcn.io is not affiliated with official shadcn/ui
Button Group examples · Media
Player Controls Button Group for React
Media player controls with previous, play or pause, and next buttons, icon-only and with labels.
The transport buttons of an audio or video player. The middle button swaps between play and pause from one playing flag, and both rows read that flag. The icon-only row names each button with an aria-label; the labeled row says Previous, Play or Pause, and Next.
Preview
Installation
FAQ
How does play switch to pause?
A playing flag starts as false. The middle button flips it, and shows PauseIcon with Pause while playing or PlayIcon with Play otherwise.
How are the icon-only controls named?
Each has an aria-label: Previous, Next, and Play or Pause from the flag. They use size="icon-sm", and the icons have aria-hidden="true".
Do both rows control the same player?
Yes. Both middle buttons flip the same flag, so they always agree.
Do Previous and Next do anything?
No. They have no handler. Wire them to your playlist or to seek the media element.
Related
- Volume Controls Button GroupVolume controls with a mute toggle and
- Playback Speed Button GroupA playback speed picker with rates from
- Zoom Controls Button GroupZoom controls that step from 25% to 400%
- Carousel Controls Button GroupCarousel controls with previous and next
- Default ToggleAn icon-only toggle that turns bold on
- Bulk Actions Button GroupA row of bulk actions, Select All