### Basic App Setup with SaltTheme Source: https://github.com/moriafly/saltui/blob/main/README.md Initialize your application with SaltTheme, providing necessary configurations. ```kotlin @Composable fun App() { SaltTheme( configs = saltConfigs() ) { // ... } } ``` -------------------------------- ### Create Clickable List Items with Item Source: https://context7.com/moriafly/saltui/llms.txt Builds navigation or settings list items with support for subtitles, icons, tags, and various arrow indicators. ```kotlin import com.moriafly.salt.ui.Item import com.moriafly.salt.ui.ItemArrowType import com.moriafly.salt.ui.RoundedColumn import androidx.compose.ui.graphics.vector.rememberVectorPainter @Composable fun NavigationList() { RoundedColumn { // Basic item with arrow Item( onClick = { /* Handle click */ }, text = "Account Settings" ) // Item with subtitle and icon Item( onClick = { /* Navigate to storage */ }, text = "Storage", sub = "Manage downloaded content", iconPainter = rememberVectorPainter(Icons.Default.Storage), iconColor = SaltTheme.colors.text ) // Item with tag (status indicator) Item( onClick = { /* Open version info */ }, text = "App Version", tag = "2.9.0", arrowType = ItemArrowType.None ) // Disabled item Item( onClick = { }, text = "Premium Features", sub = "Upgrade to unlock", enabled = false ) // External link item Item( onClick = { /* Open URL */ }, text = "Documentation", arrowType = ItemArrowType.Link ) } } ``` -------------------------------- ### Implement Dialog Components Source: https://context7.com/moriafly/saltui/llms.txt Utilize pre-built dialogs like YesDialog, YesNoDialog, and InputDialog. Requires the UnstableSaltUiApi opt-in annotation. ```kotlin import com.moriafly.salt.ui.dialog.YesDialog import com.moriafly.salt.ui.dialog.YesNoDialog import com.moriafly.salt.ui.dialog.InputDialog import com.moriafly.salt.ui.dialog.BasicDialog import com.moriafly.salt.ui.dialog.DialogTitle import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @OptIn(UnstableSaltUiApi::class) @Composable fun DialogExamples() { var showInfoDialog by remember { mutableStateOf(false) } var showConfirmDialog by remember { mutableStateOf(false) } var showInputDialog by remember { mutableStateOf(false) } var inputText by remember { mutableStateOf("") } // Simple information dialog if (showInfoDialog) { YesDialog( onDismissRequest = { showInfoDialog = false }, title = "Information", content = "Your settings have been saved successfully." ) } // Confirmation dialog with Yes/No if (showConfirmDialog) { YesNoDialog( onDismissRequest = { showConfirmDialog = false }, onConfirm = { // Handle confirmation showConfirmDialog = false }, title = "Delete Account", content = "Are you sure you want to delete your account? This action cannot be undone.", cancelText = "CANCEL", confirmText = "DELETE" ) } // Input dialog if (showInputDialog) { InputDialog( onDismissRequest = { showInputDialog = false }, onConfirm = { // Handle input submission showInputDialog = false }, title = "Rename Playlist", text = inputText, onChange = { inputText = it }, hint = "Enter playlist name" ) } // Trigger buttons Button(onClick = { showInfoDialog = true }, text = "Show Info") Button(onClick = { showConfirmDialog = true }, text = "Show Confirm") Button(onClick = { showInputDialog = true }, text = "Show Input") } ``` -------------------------------- ### Apply Styled Text Source: https://context7.com/moriafly/saltui/llms.txt Demonstrates the use of the Salt UI Text component with theme-aware colors and typography. ```kotlin import com.moriafly.salt.ui.Text import com.moriafly.salt.ui.SaltTheme import androidx.compose.ui.text.font.FontWeight @Composable fun TextExamples() { // Default text with theme styling Text(text = "Hello, Salt UI!") // Custom color text Text( text = "Highlighted text", color = SaltTheme.colors.highlight ) // Styled text Text( text = "Bold Title", fontWeight = FontWeight.Bold, style = SaltTheme.textStyles.main ) // Subtext style Text( text = "Secondary information", color = SaltTheme.colors.subText, style = SaltTheme.textStyles.sub ) } ``` -------------------------------- ### Implement BottomBar Navigation Source: https://context7.com/moriafly/saltui/llms.txt Uses BottomBar and BottomBarItem to create an app-level navigation interface. Requires the UnstableSaltUiApi opt-in. ```kotlin import com.moriafly.salt.ui.BottomBar import com.moriafly.salt.ui.BottomBarItem import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Person @OptIn(UnstableSaltUiApi::class) @Composable fun AppBottomNavigation() { var selectedTab by remember { mutableStateOf(0) } BottomBar { BottomBarItem( state = selectedTab == 0, onClick = { selectedTab = 0 }, painter = rememberVectorPainter(Icons.Default.Home), text = "Home" ) BottomBarItem( state = selectedTab == 1, onClick = { selectedTab = 1 }, painter = rememberVectorPainter(Icons.Default.Search), text = "Search" ) BottomBarItem( state = selectedTab == 2, onClick = { selectedTab = 2}, painter = rememberVectorPainter(Icons.Default.Person), text = "Profile" ) } } ``` -------------------------------- ### Implement TitleBar Navigation Source: https://context7.com/moriafly/saltui/llms.txt Use TitleBar for screen headers. Requires the UnstableSaltUiApi opt-in annotation. ```kotlin import com.moriafly.salt.ui.TitleBar import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.foundation.layout.Column @OptIn(UnstableSaltUiApi::class) @Composable fun ScreenWithTitleBar() { Column { TitleBar( onBack = { /* Navigate back */ }, text = "Settings", showBackBtn = true ) // Screen content RoundedColumn { Item( onClick = { }, text = "Option 1" ) } } } ``` -------------------------------- ### Configure Salt UI Theme Source: https://context7.com/moriafly/saltui/llms.txt Use SaltTheme to wrap your application content and provide access to theme properties. Supports basic usage with defaults and advanced customization of colors. ```kotlin import com.moriafly.salt.ui.SaltTheme import com.moriafly.salt.ui.SaltConfigs import com.moriafly.salt.ui.SaltDynamicColors import com.moriafly.salt.ui.lightSaltColors import com.moriafly.salt.ui.darkSaltColors @Composable fun App() { // Basic usage with defaults SaltTheme( configs = SaltConfigs.default(isDarkTheme = false) ) { // Your app content MainScreen() } } ``` ```kotlin import com.moriafly.salt.ui.SaltTheme import com.moriafly.salt.ui.SaltConfigs import com.moriafly.salt.ui.SaltDynamicColors import com.moriafly.salt.ui.lightSaltColors import com.moriafly.salt.ui.darkSaltColors @Composable fun AppWithCustomTheme() { // Advanced usage with custom colors SaltTheme( configs = SaltConfigs.default(isDarkTheme = true), dynamicColors = SaltDynamicColors( light = lightSaltColors( highlight = Color(0xFF0470E6), text = Color(0xFF1E1715), subText = Color(0xFF8C8C8C), background = Color(0xFFF7F9FA), subBackground = Color(0xFFFFFFFF) ), dark = darkSaltColors( highlight = Color(0xFF0088FF), text = Color(0xFFEBEEF1), subText = Color(0xBFE1E6EB), background = Color(0xFF0C0C0C), subBackground = Color(0xFF191919) ) ) ) { // Access theme properties anywhere in composition val currentColors = SaltTheme.colors val textStyles = SaltTheme.textStyles val dimens = SaltTheme.dimens MainScreen() } } ``` -------------------------------- ### Create PopupMenu Dropdown Source: https://context7.com/moriafly/saltui/llms.txt Displays an animated menu triggered by a button. Ensure the expanded state is managed to handle dismissal. ```kotlin import com.moriafly.salt.ui.popup.PopupMenu import com.moriafly.salt.ui.popup.PopupMenuItem import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @OptIn(UnstableSaltUiApi::class) @Composable fun DropdownMenuExample() { var expanded by remember { mutableStateOf(false) } Box { Button( onClick = { expanded = true }, text = "Show Menu" ) PopupMenu( expanded = expanded, onDismissRequest = { expanded = false } ) { PopupMenuItem( onClick = { // Handle edit action expanded = false }, text = "Edit", iconPainter = rememberVectorPainter(Icons.Default.Edit) ) PopupMenuItem( onClick = { // Handle share action expanded = false }, text = "Share", iconPainter = rememberVectorPainter(Icons.Default.Share) ) PopupMenuItem( onClick = { // Handle delete action expanded = false }, text = "Delete", iconPainter = rememberVectorPainter(Icons.Default.Delete), iconColor = Color.Red ) } } } ``` -------------------------------- ### Implement Action Buttons Source: https://context7.com/moriafly/saltui/llms.txt Use Button for standard actions or BasicButton for custom layouts. Ensure appropriate ButtonType is selected for primary or secondary styling. ```kotlin import com.moriafly.salt.ui.Button import com.moriafly.salt.ui.ButtonType import com.moriafly.salt.ui.BasicButton import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @Composable fun ActionButtons() { // Primary highlight button Button( onClick = { /* Submit action */ }, text = "Submit", modifier = Modifier.fillMaxWidth() ) // Secondary sub button Button( onClick = { /* Cancel action */ }, text = "Cancel", type = ButtonType.Sub ) // Disabled button Button( onClick = { }, text = "Processing...", enabled = false ) // Custom button with BasicButton BasicButton( onClick = { /* Custom action */ }, backgroundColor = Color.Red, contentPadding = PaddingValues(horizontal = 24.dp, vertical = 12.dp) ) { Icon( painter = rememberVectorPainter(Icons.Default.Delete), contentDescription = null, tint = Color.White ) Spacer(Modifier.width(8.dp)) Text( text = "Delete", color = Color.White ) } } ``` -------------------------------- ### Add Salt UI Dependency Source: https://github.com/moriafly/saltui/blob/main/README.md Add the Salt UI dependency to your project. Replace `` with the latest version available. ```kotlin implementation("io.github.moriafly:salt-ui:") ``` -------------------------------- ### Create Toggle Switch Items with ItemSwitcher Source: https://context7.com/moriafly/saltui/llms.txt Implements boolean settings toggles with optional subtitles and icons. ```kotlin import com.moriafly.salt.ui.ItemSwitcher import com.moriafly.salt.ui.RoundedColumn import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.getValue import androidx.compose.runtime.setValue @Composable fun ToggleSettings() { var darkModeEnabled by remember { mutableStateOf(false) } var notificationsEnabled by remember { mutableStateOf(true) } var autoPlayEnabled by remember { mutableStateOf(false) } RoundedColumn { // Basic toggle ItemSwitcher( state = darkModeEnabled, onChange = { darkModeEnabled = it }, text = "Dark Mode" ) // Toggle with subtitle ItemSwitcher( state = notificationsEnabled, onChange = { notificationsEnabled = it }, text = "Push Notifications", sub = "Receive alerts for new content" ) // Toggle with icon ItemSwitcher( state = autoPlayEnabled, onChange = { autoPlayEnabled = it }, text = "Auto-Play Videos", sub = "Automatically play videos when scrolling", iconPainter = rememberVectorPainter(Icons.Default.PlayArrow), iconColor = SaltTheme.colors.highlight ) // Disabled toggle ItemSwitcher( state = false, onChange = { }, text = "Premium Feature", sub = "Upgrade to enable", enabled = false ) } } ``` -------------------------------- ### Create Checkbox List Items with ItemCheck Source: https://context7.com/moriafly/saltui/llms.txt Provides a checkable component for multi-select lists, requiring the UnstableSaltUiApi opt-in. ```kotlin import com.moriafly.salt.ui.ItemCheck import com.moriafly.salt.ui.RoundedColumn import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @OptIn(UnstableSaltUiApi::class) @Composable fun MultiSelectList() { val selectedItems = remember { mutableStateOf(setOf()) } RoundedColumn { ItemCheck( state = "music" in selectedItems.value, onChange = { checked -> selectedItems.value = if (checked) { selectedItems.value + "music" } else { selectedItems.value - "music" } }, text = "Music", sub = "Include audio files" ) ItemCheck( state = "videos" in selectedItems.value, onChange = { checked -> selectedItems.value = if (checked) { selectedItems.value + "videos" } else { selectedItems.value - "videos" } }, text = "Videos", sub = "Include video files" ) ItemCheck( state = "images" in selectedItems.value, onChange = { checked -> selectedItems.value = if (checked) { selectedItems.value + "images" } else { selectedItems.value - "images" } }, text = "Images" ) } } ``` -------------------------------- ### Add Salt UI Dependency Source: https://context7.com/moriafly/saltui/llms.txt Add the Salt UI dependency to your project's build.gradle.kts file. Replace with the latest version. ```kotlin // build.gradle.kts dependencies { // Replace with the latest version (e.g., 2.9.0-beta01) implementation("io.github.moriafly:salt-ui:") } ``` -------------------------------- ### Layout with ItemOuter Components Source: https://context7.com/moriafly/saltui/llms.txt Utilizes external layout components like titles and spacers outside of RoundedColumn containers. ```kotlin import com.moriafly.salt.ui.ItemOuterTitle import com.moriafly.salt.ui.ItemOuterTip import com.moriafly.salt.ui.ItemOuterLargeTitle import com.moriafly.salt.ui.ItemOuterSpacer import com.moriafly.salt.ui.UnstableSaltUiApi @OptIn(UnstableSaltUiApi::class) @Composable fun SettingsScreen() { Column { // Large header title ItemOuterLargeTitle( text = "Settings", sub = "Customize your app experience" ) // Section title ItemOuterTitle(text = "Account") RoundedColumn { Item(onClick = { }, text = "Profile") Item(onClick = { }, text = "Security") } // Tip text below section ItemOuterTip(text = "Manage your account settings and security preferences") ItemOuterSpacer() ItemOuterTitle(text = "Appearance") RoundedColumn { ItemSwitcher( state = false, onChange = { }, text = "Dark Mode" ) } } } ``` -------------------------------- ### Implement ItemEdit for Text Inputs Source: https://context7.com/moriafly/saltui/llms.txt Use ItemEdit for standard text fields and ItemEditPassword for secure password entry. Requires UnstableSaltUiApi opt-in for advanced features. ```kotlin import com.moriafly.salt.ui.ItemEdit import com.moriafly.salt.ui.ItemEditPassword import com.moriafly.salt.ui.RoundedColumn import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.KeyboardType @OptIn(UnstableSaltUiApi::class) @Composable fun LoginForm() { var username by remember { mutableStateOf("") } var password by remember { mutableStateOf("") } var email by remember { mutableStateOf("") } RoundedColumn { // Basic text input ItemEdit( text = username, onChange = { username = it }, hint = "Username" ) // Email input with keyboard type ItemEdit( text = email, onChange = { email = it }, hint = "Email address", keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Email ) ) // Password input with visibility toggle ItemEditPassword( text = password, onChange = { password = it }, hint = "Password" ) } } ``` -------------------------------- ### Show Status Messages with ItemInfo Source: https://context7.com/moriafly/saltui/llms.txt Use ItemInfo to display contextual messages using the ItemInfoType enum for styling. ```kotlin import com.moriafly.salt.ui.ItemInfo import com.moriafly.salt.ui.ItemInfoType @Composable fun StatusMessages() { // Success message ItemInfo( text = "Your changes have been saved successfully", infoType = ItemInfoType.Success ) // Warning message ItemInfo( text = "Your subscription expires in 3 days", infoType = ItemInfoType.Warning ) // Error message ItemInfo( text = "Failed to connect to server. Please try again.", infoType = ItemInfoType.Error ) } ``` -------------------------------- ### Disable Dependencies Info Reporting for Google Play Source: https://github.com/moriafly/saltui/blob/main/README.md To publish on Google Play, disable dependencies info reporting in your `build.gradle` file to avoid issues with hidden API usage. ```kotlin android { dependenciesInfo { includeInApk = false includeInBundle = false } } ``` -------------------------------- ### Implement Standalone Toggle Switcher Source: https://context7.com/moriafly/saltui/llms.txt Use the Switcher component for toggling states outside of list items. Requires a boolean state to track the toggle status. ```kotlin import com.moriafly.salt.ui.Switcher import androidx.compose.foundation.layout.Row @Composable fun StandaloneToggle() { var enabled by remember { mutableStateOf(false) } Row( verticalAlignment = Alignment.CenterVertically ) { Text(text = "Enable feature") Spacer(Modifier.width(16.dp)) Switcher(state = enabled) } } ``` -------------------------------- ### Configure Sliders with ItemSlider Source: https://context7.com/moriafly/saltui/llms.txt ItemSlider supports basic numeric adjustment, icon integration, and discrete steps. Use onValueChangeFinished to trigger actions after interaction ends. ```kotlin import com.moriafly.salt.ui.ItemSlider import com.moriafly.salt.ui.RoundedColumn import com.moriafly.salt.ui.UnstableSaltUiApi import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.remember @OptIn(UnstableSaltUiApi::class) @Composable fun AudioSettings() { var volume by remember { mutableFloatStateOf(0.7f) } var brightness by remember { mutableFloatStateOf(0.5f) } var speed by remember { mutableFloatStateOf(1.0f) } RoundedColumn { // Basic slider ItemSlider( value = volume, onValueChange = { volume = it }, text = "Volume", sub = "${(volume * 100).toInt()}%" ) // Slider with icon ItemSlider( value = brightness, onValueChange = { brightness = it }, text = "Brightness", sub = "${(brightness * 100).toInt()}%", iconPainter = rememberVectorPainter(Icons.Default.Brightness7) ) // Discrete slider with steps ItemSlider( value = speed, onValueChange = { speed = it }, text = "Playback Speed", sub = "${speed}x", valueRange = 0.5f..2.0f, steps = 5, onValueChangeFinished = { // Save preference when user finishes adjusting } ) } } ``` -------------------------------- ### Display Data with ItemValue Source: https://context7.com/moriafly/saltui/llms.txt Use ItemValue to present read-only label-value pairs within a RoundedColumn. ```kotlin import com.moriafly.salt.ui.ItemValue import com.moriafly.salt.ui.RoundedColumn @Composable fun DeviceInfoScreen() { RoundedColumn { ItemValue( text = "Device Model", sub = "Pixel 7 Pro" ) ItemValue( text = "Android Version", sub = "14" ) ItemValue( text = "App Version", sub = "2.9.0-beta01" ) ItemValue( text = "Device ID", sub = "abc123-def456-ghi789" ) } } ``` -------------------------------- ### Use RoundedColumn for Grouped Items Source: https://context7.com/moriafly/saltui/llms.txt RoundedColumn is a container with rounded corners and a border, suitable for grouping Item components. It can be styled with custom background colors and padding. ```kotlin import com.moriafly.salt.ui.RoundedColumn import com.moriafly.salt.ui.Item import com.moriafly.salt.ui.ItemSwitcher import com.moriafly.salt.ui.SaltTheme @Composable fun SettingsSection() { // Basic RoundedColumn with default styling RoundedColumn { Item( onClick = { /* Navigate to profile */ }, text = "Profile Settings", sub = "Manage your account" ) Item( onClick = { /* Navigate to notifications */ }, text = "Notifications", sub = "Configure alerts and sounds" ) } // RoundedColumn with custom background color RoundedColumn( color = SaltTheme.colors.subBackground, paddingValues = PaddingValues( horizontal = SaltTheme.dimens.padding, vertical = SaltTheme.dimens.padding * 0.5f ) ) { ItemSwitcher( state = true, onChange = { newState -> /* Handle toggle */ }, text = "Dark Mode", sub = "Enable dark theme" ) } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.