Skip to content

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.

kotlin
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 ​

ComponentUse
ButtonA standard text or icon action.
BasicButtonLower-level control of button content and styling.
PillButtonA capsule or circular button.
SwitcherA standalone boolean control.
SliderA standalone continuous value control.
kotlin
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 ​

ComponentUse
CardRounded vertical content with clipping, background, and optional stroke. Set inner padding on the content.
RoundedColumnA group with outer margins, suitable for a set of items.
ScreenCardA page section with optional heading and supporting text.
SurfaceContainer semantics and input handling. Supply the background in the modifier.
JustifiedRowA horizontal row aligned at both ends with configurable spacing.
kotlin
@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.

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