Skip to Content
Documentation

Collections

The components of songstress/ui for collections, each as Songstress draws it, with its props and an example.

Many of a kind: rows in a list, rows of cells in a table, nodes in a tree, cards on a shelf. Each row and card is your own; to show the library’s own songs and albums, use its items (The library).

Each picture is the SDK’s own test tree for the component, drawn by the web app; every app draws the same tree with its own controls, the phones natively. Each example is the one in the SDK’s doc comment, which its tests compile, and the props are read from its types.

List

A list titled Loved lately: rows with a cover, a badge and a switchA list titled Loved lately: rows with a cover, a badge and a switch

Rows, as a block: a list node, its rows its children. Its empty state is emptyTitle, emptyText and emptyIcon.

Example: List
import { List, SongItem } from 'songstress/ui'

const songIds = ['s1', 's2', 's3']
const recent = (
  <List title="Played lately" emptyTitle="Nothing played yet" emptyIcon="music">
    {songIds.map((id) => <SongItem key={id} id={id} />)}
  </List>
)

In the reference: List.

Prop

Type

ListItem

A row of a List: a row node, onPress its action.

Example: ListItem
import { Badge, List, ListItem } from 'songstress/ui'

const stations = (
  <List>
    <ListItem id="night" title="Night radio" subtitle="Slow songs, after ten" icon="radio" trailing={<Badge>New</Badge>} onPress={{ type: 'navigate', to: { page: 'night' } }} />
  </List>
)

In the reference: ListItem.

Prop

Type

Table

A table of rows under its columns: text, a badge, progress and a timeA table of rows under its columns: text, a badge, progress and a time

Rows of cells under column headings: a table node.

Example: Table
import { Table } from 'songstress/ui'

const top = (
  <Table
    columns={[{ id: 'song', title: 'Song' }, { id: 'plays', title: 'Plays', align: 'end' }]}
    rows={[{ id: 's1', cells: ['So What', 12] }, { id: 's2', cells: ['Blue in Green', 9] }]}
  />
)

In the reference: Table.

Prop

Type

Tree

A tree of nodes, one open on the nodes it holdsA tree of nodes, one open on the nodes it holds

Nodes that hold nodes, as a block: a tree node, its top nodes its children. A node's open is how it stands at first: the app keeps what the person opens and closes, and tells onExpand.

Example: Tree
import { Tree, TreeItem } from 'songstress/ui'

// 2026 stands open at first; a tap closes it, and the handler is told.
const years = (
  <Tree onExpand={({ id, open }) => console.log(id, open)}>
    <TreeItem id="2026" title="2026" open>
      <TreeItem id="2026-11" title="November" subtitle="42 plays" />
    </TreeItem>
  </Tree>
)

In the reference: Tree.

Prop

Type

TreeItem

A node of a Tree: a node node, onPress its action, the nodes under it its children.

Example: TreeItem
import { Tree, TreeItem } from 'songstress/ui'

// A node whose nodes come later: `expandable`, and the tree's onExpand loads them.
const folders = (
  <Tree onExpand={{ type: 'refresh' }}>
    <TreeItem id="jazz" title="Jazz" icon="folder" expandable />
  </Tree>
)

In the reference: TreeItem.

Prop

Type

Shelf

A shelf titled For you: cards that scroll sidewaysA shelf titled For you: cards that scroll sideways

A row of cards that scrolls sideways: a shelf node, its cards its children.

Example: Shelf
import { MediaCard, Shelf } from 'songstress/ui'

const mixes = (
  <Shelf title="Mixes">
    <MediaCard id="night" title="Night radio" image={{ asset: 'images/night.png' }} onPress={{ type: 'navigate', to: { page: 'night' } }} />
    <MediaCard id="morning" title="Morning" image={{ asset: 'images/morning.png' }} onPress={{ type: 'navigate', to: { page: 'morning' } }} />
  </Shelf>
)

In the reference: Shelf.

Prop

Type

MediaCard

A card of the extension's own: a card node, onPress its action.

Example: MediaCard
import { MediaCard, Shelf } from 'songstress/ui'

const mixes = (
  <Shelf title="Mixes">
    <MediaCard id="night" title="Night radio" subtitle="Slow songs, after ten" image={{ asset: 'images/night.png' }} onPress={{ type: 'toast', message: 'Starting' }} />
  </Shelf>
)

In the reference: MediaCard.

Prop

Type

On this page