Home Dashboard Layout PackGuidesFree cards

Media Shelf Card

A card that shows the library of a media player, such as your playlists, as a grid of covers (or a list). Pick a speaker, tap a cover, it plays. A small "now playing" strip with previous, play/pause and next sits on top. No dependencies, one JavaScript file, a visual editor included.

Media Shelf Card screenshot

Free, MIT licensed. Version 1.0.0. Download media-shelf-card.js (19 KB)

Manual install (about 2 minutes, no HACS)
  1. Download media-shelf-card.js.
  2. Copy it into /config/www/dashpack/ on your Home Assistant (create the folder if needed; restart once if /config/www did not exist).
  3. Turn on Advanced mode in your profile. Then Settings > Dashboards > three dots > Resources > Add resource: URL /local/dashpack/media-shelf-card.js, type JavaScript module.
  4. Hard-refresh the browser (Ctrl+Shift+R / Cmd+Shift+R). The card is now available as custom:media-shelf-card.

Use

Add the card from the card picker ("Media Shelf Card") or in YAML:

type: custom:media-shelf-card
entity: media_player.spotify
category: playlists
columns: 3
limit: 12
default_device: Kitchen
KeyDescription
entityRequired. A media_player.* entity that supports browsing media.
nameTitle. Defaults to the entity name.
categoryWhich section of the library to show. The card reads the root of the media browser and opens the first entry whose title, content id or content type contains this text (case-insensitive). Default playlists. Use featured for featured playlists, root (or all) to show the top level itself. If nothing matches, the top level is shown.
viewgrid (default) or list.
columnsCovers per row in grid view, 1-8. Default 3.
limitMaximum number of items shown. Default 24.
max_heightHeight in pixels after which the items scroll. Default: no limit.
searchtrue adds a search box that filters the loaded items by title.
filterShow only items matching at least one pattern. List of regular expressions, or a comma separated string. A pattern matches the whole title, case-insensitive. Prefix with title:, media_content_id:, media_content_type: or media_class: to match another field, for example media_content_id:spotify:playlist:abc.*. An invalid pattern is ignored.
default_deviceName of the speaker (a source of the media player) to preselect. Otherwise the player's current source is used, then the first one.
filter_devicesHide speakers whose name matches a pattern (same format as filter, whole name).
shuffletrue or false: call media_player.shuffle_set before playing. Leave out to not touch shuffle.
show_now_playingShow the now-playing strip while something plays or is paused. Default true.

The speaker list is the source_list attribute of the media player. When you tap a cover and the chosen speaker is not the current source, the card calls media_player.select_source first, then media_player.play_media with the item's content id and content type. The item matching the media_playlist attribute of the player is outlined as "Playing" where the integration provides that attribute.

filter, filter_devices and shuffle are edited in YAML; the visual editor covers the other options and keeps those keys.

Example dashboard

A small sample view you can paste into the raw configuration editor (replace the placeholder entity ids with your own):

title: Music
path: music
type: sections
max_columns: 1
sections:
  - type: grid
    cards:
      - type: custom:media-shelf-card
        entity: media_player.spotify
        category: playlists
        columns: 3
        limit: 12
        search: true
      - type: grid
        columns: 2
        square: false
        cards:
          - type: tile
            entity: light.living_room
          - type: tile
            entity: climate.thermostat
          - type: tile
            entity: cover.garage_door
          - type: tile
            entity: lock.front_door

8 more ready-made views (living room, bedroom, kitchen, cameras, security, energy, mobile) are in the Home Dashboard Layout Pack ($9): https://dashpack.strahmdigital.com/

Coming from custom:spotify-card

That card (custom-cards/spotify-card) has not had a commit since May 2023 and its last release is from 2021. It needs the Spotify integration plus the separate spotcast integration, and its open issues describe the card stuck on "Loading..." (#182, #197 since Home Assistant 2023.3), an empty playlist list (#212) and "No devices found" (#219, 2025). This card is an independent rewrite with a different data path: it asks the media player itself for its library and does not need spotcast. Options carry over like this (names taken from that card's README):

  1. Change type: custom:spotify-card to type: custom:media-shelf-card.
  2. Map the options:
Old optionHere
spotify_entityentity (required here; it is not auto-detected)
namename
limitlimit
heightmax_height
display_style: Gridview: grid (or list)
grid_covers_per_rowcolumns
default_device / devicedefault_device
filter_devicesfilter_devices (whole-name patterns, same idea)
playlist filtersfilter (same field:pattern idea; the fields are the browse item fields listed above)
always_play_random_songshuffle: true
playlist_type: featuredcategory: featured
playlist_type: discover-weekly, country_codenot supported (what the library offers depends on the integration)
account, hide_warning, known_connect_devicesnot supported (no spotcast; speakers come from the player's source list)
  1. Check the layout: this card is a similar but not pixel-identical design.

Honest limits: speakers that are not in the media player's source_list cannot be chosen, and what appears in the library (playlists, featured, new releases, artists) is decided by the media player's integration, not by this card.

All free cards · Dashboard guides