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
| Need | Component | Behavior |
|---|---|---|
| Open a screen or action | Item | Calls onClick. |
| Switch a boolean setting | ItemSwitcher | The entire row changes state through onChange. |
| Check a selection | ItemCheck | Supplies its own selection interaction. |
| Display a read-only label and value | ItemValue | Displays a value alongside its label. |
| Edit text or a password | ItemEdit, ItemEditPassword | The caller owns editing state and submission. |
| Adjust a continuous value | ItemSlider | Pair it with a meaningful value or unit. |
| Run an immediate action | ItemButton | Executes the named action. |
| Choose a setting from a list | ItemDropdown | Shows the current value alongside popup options. |
| Give supporting information | ItemTip, ItemInfo | ItemInfo supports icon and color. |
| Separate groups | ItemDivider, ItemSpacer | Add 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.