Skip to content
Brok UI

Loading…

No results

Media Widget

Open source

Player widgets — a circular radial control pad and a now-playing card with a scrollable playlist.

Preview

resources/views/blocks/media-widget-playlist.blade.php Blade
@props([
    // Now-playing track. All synthetic / static.
    'title' => 'Midnight Drive',
    'artist' => 'The Neon Collective',
    'progress' => 45,
    // Up-next playlist rows.
    'playlist' => [
        ['title' => 'Sapphire', 'artist' => 'Aurora Lane'],
        ['title' => 'Jamrock', 'artist' => 'Nucleya Sound'],
        ['title' => 'Bumaye', 'artist' => 'Major Echo'],
        ['title' => 'Taki Taki', 'artist' => 'DJ Mirage'],
        ['title' => 'Raabta', 'artist' => 'Arijit Vale'],
    ],
])

<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-md p-4']) }}>
    <div data-slot="media-widget-playlist" class="flex flex-col gap-4 sm:flex-row">
        {{-- Now playing --}}
        <div class="flex flex-col gap-4 sm:w-1/2">
            <div class="aspect-square w-full rounded-lg bg-gradient-to-br from-primary/30 to-muted" aria-hidden="true"></div>

            <div class="space-y-0.5">
                <p class="truncate text-sm font-medium text-foreground">{{ $title }}</p>
                <p class="truncate text-xs text-muted-foreground">{{ $artist }}</p>
            </div>

            <x-ui.progress :value="$progress" class="h-2" aria-label="{{ __('Track progress') }}" />

            <div class="mx-auto flex items-center gap-4">
                <x-ui.button variant="ghost" size="icon-sm" aria-label="{{ __('Previous track') }}">
                    <svg class="size-4 rtl:[transform:scaleX(-1)]" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M18 6 9 12l9 6V6zM6 6h2v12H6z" />
                    </svg>
                </x-ui.button>
                <x-ui.button variant="default" size="icon" shape="pill" aria-label="{{ __('Play') }}">
                    <svg class="size-4" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M8 5v14l11-7z" />
                    </svg>
                </x-ui.button>
                <x-ui.button variant="ghost" size="icon-sm" aria-label="{{ __('Next track') }}">
                    <svg class="size-4 rtl:[transform:scaleX(-1)]" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M6 6l9 6-9 6V6zM16 6h2v12h-2z" />
                    </svg>
                </x-ui.button>
            </div>
        </div>

        {{-- Up-next playlist --}}
        <div class="sm:w-1/2">
            <p class="mb-2 text-xs font-medium text-muted-foreground">{{ __('Up next') }}</p>
            <ul class="max-h-48 space-y-2 overflow-y-auto pe-2">
                @foreach ($playlist as $i => $row)
                    <li>
                        <button
                            type="button"
                            class="flex w-full items-center gap-2 rounded-md p-2 text-start transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none"
                            aria-label="{{ __('Play :title by :artist', ['title' => $row['title'], 'artist' => $row['artist']]) }}"
                        >
                            <span
                                class="size-9 shrink-0 rounded-md bg-gradient-to-br {{ $i % 2 === 0 ? 'from-primary/30 to-muted' : 'from-secondary to-muted' }}"
                                aria-hidden="true"
                            ></span>
                            <span class="min-w-0">
                                <span class="block truncate text-sm text-foreground">{{ $row['title'] }}</span>
                                <span class="block truncate text-xs text-muted-foreground">{{ $row['artist'] }}</span>
                            </span>
                        </button>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/media-widget-playlist

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/media-widget-playlist writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.0.3
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/media-widget-playlist.blade.php

Registry dependencies

card button progress

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

media-widget-playlist.md
# Brok UI block: Media Widget Playlist (`media-widget-playlist`)

A wide now-playing media card with album art, scrubber and transport controls beside a scrollable up-next playlist.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/media-widget-playlist
```

## Render it

```blade
<x-blocks.media-widget-playlist />
```

## Props

- `title` (string, default `Midnight Drive`) — Now-playing track title.
- `artist` (string, default `The Neon Collective`) — Now-playing track artist.
- `progress` (int, default `45`) — Track progress 0-100 shown on the progress bar.
- `playlist` (array, default `[…]`) — Up-next rows of {title, artist}.

## Use when

- Showing a now-playing media card with album art, a progress bar, and transport icon buttons beside a scrollable up-next playlist.
- Wanting a static, decorative media-player mockup rather than a working player.

## Avoid when

- Needing a functioning play/pause and seek control; use music-player-card or music-player-spotify-vertical, which wire real Alpine playback state.

## Rules

- Render the installed block with `<x-blocks.media-widget-playlist />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/media-widget-playlist
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/media-widget-playlist.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Showing a now-playing media card with album art, a progress bar, and transport icon buttons beside a scrollable up-next playlist.
  • Wanting a static, decorative media-player mockup rather than a working player.

Avoid when

  • Needing a functioning play/pause and seek control; use music-player-card or music-player-spotify-vertical, which wire real Alpine playback state.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
now-playing panel with album art and progress bar transport buttons scrollable up-next playlist

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.media-widget-playlist />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/media-widget-playlist.blade.php Blade
@props([
    // Now-playing track. All synthetic / static.
    'title' => 'Midnight Drive',
    'artist' => 'The Neon Collective',
    'progress' => 45,
    // Up-next playlist rows.
    'playlist' => [
        ['title' => 'Sapphire', 'artist' => 'Aurora Lane'],
        ['title' => 'Jamrock', 'artist' => 'Nucleya Sound'],
        ['title' => 'Bumaye', 'artist' => 'Major Echo'],
        ['title' => 'Taki Taki', 'artist' => 'DJ Mirage'],
        ['title' => 'Raabta', 'artist' => 'Arijit Vale'],
    ],
])

<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-md p-4']) }}>
    <div data-slot="media-widget-playlist" class="flex flex-col gap-4 sm:flex-row">
        {{-- Now playing --}}
        <div class="flex flex-col gap-4 sm:w-1/2">
            <div class="aspect-square w-full rounded-lg bg-gradient-to-br from-primary/30 to-muted" aria-hidden="true"></div>

            <div class="space-y-0.5">
                <p class="truncate text-sm font-medium text-foreground">{{ $title }}</p>
                <p class="truncate text-xs text-muted-foreground">{{ $artist }}</p>
            </div>

            <x-ui.progress :value="$progress" class="h-2" aria-label="{{ __('Track progress') }}" />

            <div class="mx-auto flex items-center gap-4">
                <x-ui.button variant="ghost" size="icon-sm" aria-label="{{ __('Previous track') }}">
                    <svg class="size-4 rtl:[transform:scaleX(-1)]" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M18 6 9 12l9 6V6zM6 6h2v12H6z" />
                    </svg>
                </x-ui.button>
                <x-ui.button variant="default" size="icon" shape="pill" aria-label="{{ __('Play') }}">
                    <svg class="size-4" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M8 5v14l11-7z" />
                    </svg>
                </x-ui.button>
                <x-ui.button variant="ghost" size="icon-sm" aria-label="{{ __('Next track') }}">
                    <svg class="size-4 rtl:[transform:scaleX(-1)]" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                        <path d="M6 6l9 6-9 6V6zM16 6h2v12h-2z" />
                    </svg>
                </x-ui.button>
            </div>
        </div>

        {{-- Up-next playlist --}}
        <div class="sm:w-1/2">
            <p class="mb-2 text-xs font-medium text-muted-foreground">{{ __('Up next') }}</p>
            <ul class="max-h-48 space-y-2 overflow-y-auto pe-2">
                @foreach ($playlist as $i => $row)
                    <li>
                        <button
                            type="button"
                            class="flex w-full items-center gap-2 rounded-md p-2 text-start transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none"
                            aria-label="{{ __('Play :title by :artist', ['title' => $row['title'], 'artist' => $row['artist']]) }}"
                        >
                            <span
                                class="size-9 shrink-0 rounded-md bg-gradient-to-br {{ $i % 2 === 0 ? 'from-primary/30 to-muted' : 'from-secondary to-muted' }}"
                                aria-hidden="true"
                            ></span>
                            <span class="min-w-0">
                                <span class="block truncate text-sm text-foreground">{{ $row['title'] }}</span>
                                <span class="block truncate text-xs text-muted-foreground">{{ $row['artist'] }}</span>
                            </span>
                        </button>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
</x-ui.card>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.3
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0