Skip to content

Items ​

Items are rows for settings, input, navigation, and status. Group related items in ScreenCard or RoundedColumn.

Build a settings section ​

kotlin
@OptIn(UnstableSaltUiApi::class)
@Composable
fun PlaybackSettings(
    onOpenEqualizer: () -> Unit
) {
    var enabled by rememberSaveable { mutableStateOf(false) }

    ScreenCard(
        header = "Playback",
        footer = "Turn this off to use the default playback behavior."
    ) {
        ItemSwitcher(
            state = enabled,
            onChange = { enabled = it },
            text = "Enable playback enhancements"
        )
        Item(
            onClick = onOpenEqualizer,
            text = "Equalizer"
        )
    }
}

Choose an item ​

NeedComponentBehavior
Open a screen or actionItemCalls onClick.
Switch a boolean settingItemSwitcherThe entire row changes state through onChange.
Check a selectionItemCheckSupplies its own selection interaction.
Display a read-only label and valueItemValueDisplays a value alongside its label.
Edit text or a passwordItemEdit, ItemEditPasswordThe caller owns editing state and submission.
Adjust a continuous valueItemSliderPair it with a meaningful value or unit.
Run an immediate actionItemButtonExecutes the named action.
Choose a setting from a listItemDropdownShows the current value alongside popup options.
Give supporting informationItemTip, ItemInfoItemInfo supports icon and color.
Separate groupsItemDivider, ItemSpacerAdd separation where rows form distinct groups.

See the Item and ItemDropdown source for full declarations.

Add a heading or supporting text ​

Place ItemOuterTitle, ItemOuterLargeTitle, or ItemOuterTip outside the group. ItemOuterEdit provides a standalone editor, ItemOuterTextButton adds a text action, and ItemOuterSpacer or ItemOuterHalfSpacer adds spacing.

kotlin
ItemOuterTitle(text = "Playback")
RoundedColumn {
    Item(
        onClick = onOpenEqualizer,
        text = "Equalizer"
    )
}
ItemOuterTip(text = "Adjust audio output.")

Use ScreenCard(header = ..., footer = ...) when the heading, card, and supporting text form a complete section.

Build a custom row ​

ItemArrow and ItemPopupArrow provide the corresponding visuals for custom rows. Use Modifier.innerPadding() to match the spacing of built-in rows. RoundedColumn and ScreenCard already apply secondary material.

Google/Android 是 Google LLC 的注册商标,Salt Player 和糖醋音乐均是寻浔科技(上海)有限公司在中华人民共和国的注册商标