Skip to Content
Documentation

Controls

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

What a person presses, switches, slides, picks and types. Each takes its value and tells your handler what the person chose: an action anywhere, a function in client code (see State and handlers).

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.

Button

Buttons: primary, secondary, quiet and danger, one busy and one disabledButtons: primary, secondary, quiet and danger, one busy and one disabled

A button: a button node, onPress its action.

Example: Button
import { Button, Text, useState } from 'songstress/ui'

function Counter() {
  const [count, setCount] = useState(0)
  return (
    <>
      <Text>{`Pressed ${count} times`}</Text>
      <Button title="Add one" icon="add" emphasis="primary" onPress={() => setCount((was) => was + 1)} />
    </>
  )
}

In the reference: Button.

Prop

Type

IconButton

Two icon buttons, Like and DeleteTwo icon buttons, Like and Delete

A button that shows an icon alone: an icon-button node, onPress its action.

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

const reload = <IconButton icon="refresh" label="Look again" onPress={{ type: 'refresh' }} />

In the reference: IconButton.

Prop

Type

A button titled More that opens a menuA button titled More that opens a menu

A button that opens a menu: a menu node, its entries its MenuOption children.

Example: Menu
import { Menu, MenuOption } from 'songstress/ui'

const more = (
  <Menu title="More" icon="settings">
    <MenuOption title="Look again" icon="refresh" onSelect={{ type: 'refresh' }} />
    <MenuOption title="Say hello" onSelect={() => ({ type: 'toast', message: 'Hello' })} />
  </Menu>
)

In the reference: Menu.

Prop

Type

A menu item: one entry of a Menu, or of a ListItem's, a TreeItem's or a MediaCard's menu. onSelect is what choosing it does.

Example: MenuOption
import { confirmed, Menu, MenuOption } from 'songstress/ui'

const more = (
  <Menu title="More">
    <MenuOption title="Forget every play" icon="trash" destructive onSelect={confirmed({ title: 'Forget every play?' }, { type: 'invoke', command: 'forget' })} />
  </Menu>
)

In the reference: MenuOption.

Prop

Type

Switch

A switch labelled Scrobble, onA switch labelled Scrobble, on

On or off, as a switch: a switch node, told a boolean.

Example: Switch
import { Switch, useState } from 'songstress/ui'

function Loud() {
  const [loud, setLoud] = useState(false)
  return <Switch label="Loud" help="Plays the next song louder." value={loud} onChange={setLoud} />
}

In the reference: Switch.

Prop

Type

Checkbox

A checkbox labelled Only loved songsA checkbox labelled Only loved songs

On or off, as a checkbox: a checkbox node, told a boolean.

Example: Checkbox
import { Checkbox, useState } from 'songstress/ui'

function Intros() {
  const [skip, setSkip] = useState(true)
  return <Checkbox label="Skip intros" value={skip} onChange={setSkip} />
}

In the reference: Checkbox.

Prop

Type

Slider

A slider labelled VolumeA slider labelled Volume

A number in a range: a slider node, told a number.

Example: Slider
import { Slider, useState } from 'songstress/ui'

function Fade() {
  const [seconds, setSeconds] = useState(4)
  return <Slider label="Fade" value={seconds} minimum={0} maximum={12} step={1} onChange={setSeconds} />
}

In the reference: Slider.

Prop

Type

Select

A select labelled ServiceA select labelled Service

One of a list, in a menu: a select node, told the option's value.

Example: Select
import { Select, useState } from 'songstress/ui'

const ORDERS = [
  { value: 'recent', title: 'Most recent' },
  { value: 'plays', title: 'Most played' },
]

function Order() {
  const [order, setOrder] = useState('recent')
  return <Select label="Sort by" options={ORDERS} value={order} onChange={setOrder} />
}

In the reference: Select.

Prop

Type

Segmented

A segmented control labelled RangeA segmented control labelled Range

One of a few, side by side: a segmented node, told the option's value.

Example: Segmented
import { Segmented, useState } from 'songstress/ui'

function Span() {
  const [span, setSpan] = useState('week')
  return (
    <Segmented
      label="Over"
      options={[{ value: 'week', title: 'Week' }, { value: 'year', title: 'Year' }]}
      value={span}
      onChange={setSpan}
    />
  )
}

In the reference: Segmented.

Prop

Type

TextInput

Two text fields: Name on one line, and Notes on severalTwo text fields: Name on one line, and Notes on several

A line of text, or several: a text-field node, told what it holds.

Example: TextInput
import { TextInput, useState } from 'songstress/ui'

function MixName() {
  const [name, setName] = useState('')
  return (
    <TextInput
      label="Name"
      placeholder="A name for the mix"
      value={name}
      onChange={setName}
      onSubmit={(value) => ({ type: 'toast', message: `Saved ${value}` })}
    />
  )
}

In the reference: TextInput.

Prop

Type

SearchField

A search field: Search playsA search field: Search plays

The app's search field: a search-field node, told what it holds.

Example: SearchField
import { SearchField, useState } from 'songstress/ui'

function Find() {
  const [term, setTerm] = useState('')
  return <SearchField placeholder="Search your plays" value={term} onChange={setTerm} />
}

In the reference: SearchField.

Prop

Type

DatePicker

A date picker labelled SinceA date picker labelled Since

A day: a date-picker node, told the day as YYYY-MM-DD.

Example: DatePicker
import { DatePicker, useState } from 'songstress/ui'

function Since() {
  const [since, setSince] = useState('2026-11-01')
  return <DatePicker label="Since" value={since} maximum="2026-12-31" onChange={setSince} />
}

In the reference: DatePicker.

Prop

Type

On this page