Skip to content

SuperArrow

SuperArrow is a directional indicator component in Miuix, typically used for navigation or displaying additional content. It provides a title, summary, and right arrow icon with click interaction support, commonly used in settings, menu items, or list items.

Import

kotlin
import top.yukonga.miuix.kmp.extra.SuperArrow

Basic Usage

The SuperArrow component provides basic click navigation functionality:

kotlin
SuperArrow(
    title = "Setting Item",
    onClick = { /* Handle click event */ }
)

Arrow with Summary

kotlin
SuperArrow(
    title = "Wireless Network",
    summary = "Connected to WIFI-HOME",
    onClick = { /* Handle click event */ }
)

Component States

Disabled State

kotlin
SuperArrow(
    title = "Disabled Item",
    summary = "This item is currently unavailable",
    enabled = false,
    onClick = { /* Won't be triggered */ }
)

Hold Down State

SuperArrow supports controlling the hold-down state through the holdDownState parameter, typically used for visual feedback when displaying popup dialogs:

kotlin
val showDialog = remember { mutableStateOf(false) }

Scaffold {
    SuperArrow(
        title = "Open Dialog",
        summary = "Click to show dialog",
        onClick = { showDialog.value = true },
        holdDownState = showDialog.value
    )
    // Define dialog elsewhere
    SuperDialog(
        title = "Dialog",
        show = showDialog,
        onDismissRequest = { showDialog.value = false }
    ) {
        // Dialog content
    }
}

Properties

SuperArrow Properties

Property NameTypeDescriptionDefault ValueRequired
titleStringArrow item title-Yes
titleColorBasicComponentColorsTitle text color configurationBasicComponentDefaults.titleColor()No
summaryString?Arrow item summary descriptionnullNo
summaryColorBasicComponentColorsSummary text color configurationBasicComponentDefaults.summaryColor()No
leftAction@Composable (() -> Unit)?Custom left contentnullNo
rightActions@Composable RowScope.() -> UnitCustom right-side content (slot){}No
bottomAction@Composable (() -> Unit)?Custom bottom contentnullNo
modifierModifierModifier applied to componentModifierNo
insideMarginPaddingValuesInternal content paddingBasicComponentDefaults.InsideMarginNo
onClick(() -> Unit)?Callback triggered on clicknullNo
holdDownStateBooleanWhether component is held downfalseNo
enabledBooleanWhether component is interactivetrueNo

SuperArrowDefaults Object

The SuperArrowDefaults object provides default color configuration for the trailing arrow icon.

Methods

Method NameTypeDescription
rightActionColorsRightActionColorsReturns tint colors used by the trailing arrow icon

Arrow Tint

  • The trailing arrow icon is always shown and tinted automatically.
  • Tint uses MiuixTheme.colorScheme.onSurfaceVariantActions when enabled = true.
  • Tint uses MiuixTheme.colorScheme.disabledOnSecondaryVariant when enabled = false.

Advanced Usage

With Left Icon

kotlin
SuperArrow(
    title = "Personal Information",
    summary = "View and edit your profile",
    leftAction = {
        Icon(
            imageVector = MiuixIcons.Useful.Personal,
            contentDescription = "Personal Icon",
            tint = MiuixTheme.colorScheme.onBackground,
            modifier = Modifier.padding(end = 16.dp)
        )
    },
    onClick = { /* Handle click event */ }
)

With Right Actions (Text)

kotlin
SuperArrow(
    title = "Storage Space",
    summary = "Manage app storage space",
    rightActions = {
        Text("12.5 GB")
    },
    onClick = { /* Handle click event */ }
)

Using with Dialog

kotlin
val showDialog = remember { mutableStateOf(false) }
var language by remember { mutableStateOf("Simplified Chinese") }

Scaffold {
SuperArrow(
    title = "Language Settings",
    summary = "Select app display language",
    rightActions = {
        Text(language)
    },
    onClick = { showDialog.value = true },
    holdDownState = showDialog.value
)
    SuperDialog(
        title = "Select Language",
        show = showDialog,
        onDismissRequest = { showDialog.value = false }
    ) {
        // Dialog content
        Card {
            SuperArrow(
                title = "Simplified Chinese",
                onClick = {
                    language = "Simplified Chinese"
                    showDialog.value = false
                }
            )
            SuperArrow(
                title = "English",
                onClick = {
                    language = "English"
                    showDialog.value = false
                }
            )
        }
        Row(
            horizontalArrangement = Arrangement.SpaceBetween
        ) {
            TextButton(
                text = "Cancel",
                onClick = { showDialog.value = false },
                modifier = Modifier.weight(1f).padding(top = 8.dp)
            )
        }
    }
}

Changelog

Released under the Apache-2.0 License