Skip to content
View Markdown

Picker ​

A control for choosing one option.

tsx
import { Picker } from '@satinhq/kit'

Example ​

Full example
tsx
import { useState } from 'react'
import { List, Picker, Screen, Section } from '@satinhq/kit'

function Example() {
  const [sort, setSort] = useState('title')

  return (
    <Screen>
      <List id="example">
        <Section>
          <Picker
            label="Sort"
            selection={sort}
            onSelectionChange={setSort}
            options={[
              { id: 'title', label: 'Title' },
              { id: 'author', label: 'Author' },
            ]}
          />
        </Section>
      </List>
    </Screen>
  )
}

Bind the selection ​

Each option has a stable id and label. Store an option id in selection and update it in onSelectionChange.

Choose a picker style ​

pickerStyle accepts menu, navigationLink, segmented or inline. Omit it for the contextual default.

API ​

Scroll horizontally to read every column.

PropTypeDescription
labelstringThe setting name.
optionsreadonly Choice[]The available choices.
selectionstringThe selected option id.
onSelectionChange(id: string) => voidReceives the selected id.
pickerStylePickerStyleOptional presentation style.

Related: Quick start, List, Screen.

:::

Satin runs on the Lumen rendering engine and is open source under the MIT License.