Primitives
Choose basic UI components by role. For settings rows, see Items. For a full page, see Build a screen.
Text and icons
Text and Icon read the current Salt theme. SaltIcons contains shared icons. Give a meaningful description to icons that communicate an action on their own.
Text(
text = "Additional information",
style = SaltTheme.textStyles.sub,
color = SaltTheme.colors.subText
)Import com.moriafly.salt.ui.Text and com.moriafly.salt.ui.Icon when using more than one UI library.
Buttons and value controls
| Component | Use |
|---|---|
Button | A standard text or icon action. |
BasicButton | Lower-level control of button content and styling. |
PillButton | A capsule or circular button. |
Switcher | A standalone boolean control. |
Slider | A standalone continuous value control. |
Button(
onClick = onSave,
text = "Save"
)Use ItemSwitcher, ItemSlider, or ItemButton when the title, supporting text, and entire row belong to the interaction. For a Glass button, combine ButtonAppearance.Glass with Modifier.glass().
Containers
| Component | Use |
|---|---|
Card | Rounded vertical content with clipping, background, and optional stroke. Set inner padding on the content. |
RoundedColumn | A group with outer margins, suitable for a set of items. |
ScreenCard | A page section with optional heading and supporting text. |
Surface | Container semantics and input handling. Supply the background in the modifier. |
JustifiedRow | A horizontal row aligned at both ends with configurable spacing. |
@OptIn(UnstableSaltUiApi::class)
@Composable
fun InfoCard() {
Card {
Text(
text = "Card content",
modifier = Modifier.innerPadding()
)
}
}Card, RoundedColumn, and ScreenCard already apply secondary material. Set color = Color.Unspecified to skip the background on the corresponding container.
Bars
TitleBar is a standalone title bar. BottomBar and BottomBarItem serve bottom navigation. FloatingBottomBar adds a floating glass navigation surface. Use BasicScreen for page-level title bar and insets, or Desktop for native window captions.