# Text and media

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

Page: https://songstress.app/docs/develop/components/content/

What a person reads and sees: text in its styles, prose, icons, pictures, a playing sprite, covers, and the small parts that say how things stand.

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.

## Text [#text]

<Shot name="gallery/text" alt="Text in each style: a title, a heading in the accent tone, body, a caption, a label and code" />

Words, in one of six styles: a `text` node. Its words are its children,
or `text`.

```tsx
import { Text } from 'songstress/ui'

const title = <Text style="title">Played lately</Text>
const note = <Text tone="muted" lines={2}>{`${12} songs, the last one an hour ago`}</Text>
```

A `Text`'s props: its words are its children joined, or `text`.

| Field | Type | Description |
|---|---|---|
| `text?` | `string \| undefined` | The words, when there are no children. |
| `children?` | `UiNode` | The words. |
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `style?` | `"body" \| "caption" \| "code" \| "heading" \| "label" \| "title" \| undefined` | Left out, "body". `label` is a control's label; `code` is text in a monospace face, shown as written. |
| `tone?` | `Tone \| undefined` | Their colour, by meaning. |
| `lines?` | `number \| undefined` | Cut to this many lines, from 1 to 6. Left out, all of it shows. |

## ProseText [#prosetext]

<Shot name="gallery/prose-text" alt="Prose: a paragraph with emphasis, a list and a link" />

Prose: paragraphs, lists and emphasis in the manifest's prose format, a
`prose` node. Its blocks are `blocks`, or its children's text a block a
line, as the format has it: a paragraph, a heading or a list item is one
line, and a blank line is nothing.

```tsx
import { ProseText } from 'songstress/ui'

const about = <ProseText blocks={['Counts each song you play to the end.', 'Nothing leaves your server.']} />
```

A `ProseText`'s props: its blocks are `blocks`, or its children's text
a block a line, as the prose format has it (a list item on a line of its
own is a list item; a blank line is no block).

| Field | Type | Description |
|---|---|---|
| `blocks?` | `string[] \| undefined` | The blocks: paragraphs, headings, list items. |
| `children?` | `UiNode` | The blocks, as one text with each on a line of its own. |
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |

## Glyph [#glyph]

<Shot name="gallery/glyph" alt="Three icons from Songstress’s set, in their sizes and tones" />

An icon, by name, from Songstress's icon set: an `icon` node.

```tsx
import { Glyph } from 'songstress/ui'

const mark = <Glyph name="headphones" tone="accent" size="small" />
```

A `Glyph`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `name` | `IconName` | The icon's name, from Songstress's icon set. |
| `tone?` | `Tone \| undefined` | Its colour, by meaning. |
| `size?` | `Size \| undefined` | How large. Left out, "medium". |

## Image [#image]

<Shot name="gallery/image" alt="Images in their shapes: a cover from the library, an address that did not load, and the package’s own image of frames, whole" />

A picture: an `image` node, a cover of the library, an address the app
fetches through the server, or one of the package's own images.

```tsx
import { Image } from 'songstress/ui'

// An image the package carries, by its path in the package.
const header = <Image source={{ asset: 'images/header.png' }} description="The radio's logo" shape="wide" />
```

An `Image`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `source` | `ImageSource` | Where the picture comes from. |
| `description` | `string` | What the image shows, for people who do not see it. |
| `shape?` | `"circle" \| "square" \| "wide" \| undefined` | Its shape: square, wide or a circle. |

## Sprite [#sprite]

<Shot name="gallery/sprite" alt="Sprites of the package’s own image, each playing one row of frames" />

One row of an image of frames, played: a `sprite` node.

```tsx
import { Sprite } from 'songstress/ui'

// Eight frames of 32 points in a row of the package's own image, twelve a second.
const bars = <Sprite source={{ asset: 'images/bars.png' }} frameWidth={32} frameHeight={32} frames={8} rate={12} loop description="Bars that move" />
```

A `Sprite`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `source` | `{ asset: string; } \| { file: string; }` | The image: one of the package's own by its path in `contributes.assets`, or one of the extension's files by its name (a pet a member added), as `ImageSource` finds it. |
| `frameWidth` | `number` | A frame's width, in the image's own pixels, from 1 to 256. |
| `frameHeight` | `number` | A frame's height, in the image's own pixels, from 1 to 256. |
| `frames` | `number` | How many frames of the row it plays, from 1 to 64. |
| `row?` | `number \| undefined` | The row of frames, from 0. Left out, 0. |
| `rate?` | `number \| undefined` | Frames a second, from 1 to 30. Left out, 8. |
| `durations?` | `number[] \| undefined` | How long each frame shows, in milliseconds (16 to 10,000), one for each of its `frames`. Given, `rate` is not read; a list of another length is left out. |
| `loop?` | `boolean \| undefined` | Whether it plays again from its first frame. Left out, true. With `false` it stops on its last frame, or goes on to `then`. |
| `then?` | `SpriteAnimation \| undefined` | What plays once this animation ends: "wave once, then idle". |
| `playing?` | `boolean \| undefined` | `false` holds the first frame. Left out, true. |
| `size?` | `Size \| undefined` | How wide it is drawn. Left out, "medium". |
| `description?` | `string \| undefined` | What it shows, for people who do not see it. Left out, it is decoration, hidden from screen readers. |

## Cover [#cover]

<Shot name="gallery/cover" alt="The covers of an album, an artist, a song and a playlist from the library" />

The cover of something in the library: a `cover` node.

```tsx
import { Cover } from 'songstress/ui'

const art = <Cover of="album" id="al-1" size="large" description="Kind of Blue" />
```

A `Cover`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `of` | `LibraryType` | What it is the cover of. |
| `id` | `string` | Its library id. |
| `size?` | `Size \| undefined` | How large. Left out, "medium". |
| `description?` | `string \| undefined` | What it shows, for people who do not see it. Left out, it is decoration beside words that say the same. |

## Badge [#badge]

<Shot name="gallery/badge" alt="A badge reading Beta" />

A short word in a pill: a `badge` node. Its words are its children, or
`text`.

```tsx
import { Badge } from 'songstress/ui'

const fresh = <Badge tone="success">New</Badge>
```

A `Badge`'s props: its words are its children joined, or `text`.

| Field | Type | Description |
|---|---|---|
| `text?` | `string \| undefined` | The words, when there are no children. |
| `children?` | `UiNode` | The words. |
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `tone?` | `Tone \| undefined` | Its colour, by meaning. |

## Progress [#progress]

<Shot name="gallery/progress" alt="Progress as a bar with its label, as a ring, and with no telling how far" />

How far something has got, as a bar or a ring: a `progress` node.

```tsx
import { Progress } from 'songstress/ui'

const imported = <Progress value={0.4} label="40 of 100 songs" />
const going = <Progress variant="ring" label="Looking" />
```

A `Progress`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `value?` | `number \| undefined` | From 0 to 1. Left out, it shows that something is going on without saying how far it is. |
| `label?` | `string \| undefined` | What it measures. |
| `variant?` | `"bar" \| "ring" \| undefined` | A bar across, or a ring. Left out, "bar". |

## Callout [#callout]

<Shot name="gallery/callout" alt="A callout across the top of a block: All synced" />

A banner: a notice across the top of a block, in a tone, with one
button at most: a `banner` node. Its button is `buttonTitle` and
`onPress`.

```tsx
import { Callout } from 'songstress/ui'

const down = <Callout tone="warning" title="The lyrics service is down" text="Lyrics come back when it does." buttonTitle="Try again" onPress={{ type: 'refresh' }} />
```

A `Callout`'s props: its button is `buttonTitle` and `onPress`.

| Field | Type | Description |
|---|---|---|
| `buttonTitle?` | `string \| undefined` | The button's label. |
| `onPress?` | `Handler<void> \| undefined` | What the button does. |
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `tone` | `"danger" \| "info" \| "success" \| "warning"` | Its colour, by meaning. |
| `title` | `string` | What the banner says. |
| `text?` | `string \| undefined` | A sentence more. |

## Empty [#empty]

<Shot name="gallery/empty" alt="Two empty states: Nothing played yet, and No results" />

The app's "nothing here": an `empty` node. Its button is `buttonTitle`
and `onPress`.

```tsx
import { Empty } from 'songstress/ui'

const none = <Empty title="Nothing played yet" text="Play a song to the end, and it shows here." icon="music" />
```

An `Empty`'s props: its button is `buttonTitle` and `onPress`.

| Field | Type | Description |
|---|---|---|
| `buttonTitle?` | `string \| undefined` | The button's label. |
| `onPress?` | `Handler<void> \| undefined` | What the button does. |
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `title` | `string` | What it says. |
| `text?` | `string \| undefined` | A sentence more. |
| `icon?` | `IconName \| undefined` | An icon from Songstress's icon set. Left out, "list". |

## Skeleton [#skeleton]

<Shot name="gallery/skeleton" alt="Skeletons of a line of text, a row, a card and an image, as the app shows them while something loads" />

The app's placeholder while something loads: a `skeleton` node.

```tsx
import { Skeleton } from 'songstress/ui'

const loading = <Skeleton shape="row" count={3} />
```

A `Skeleton`'s props.

| Field | Type | Description |
|---|---|---|
| `grow?` | `boolean \| undefined` | In a horizontal stack, it takes the room left over. Elsewhere it does nothing. |
| `width?` | `Width \| undefined` | Across its parent, or as wide as what it holds. Left out, the block's own way. |
| `shape?` | `"card" \| "image" \| "row" \| "text" \| undefined` | What is on its way. Left out, "text". |
| `count?` | `number \| undefined` | How many lines, rows, cards or images, from 1 to 10. Left out, 3 for text and rows, 1 for a card or an image. |
