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
var 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
rightTextString?Right text contentnullNo
rightActionColorRightActionColorsRight text and arrow color configSuperArrowDefaults.rightActionColors()No
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 values and color configurations for the arrow component.

Methods

Method NameTypeDescription
rightActionColorsRightActionColorsCreates color config for right text and arrow

RightActionColors Class

ParameterTypeDescription
colorColorColor in normal state
disabledColorColorColor in disabled state

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 Text

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

Using with Dialog

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

Scaffold {
    SuperArrow(
        title = "Language Settings",
        summary = "Select app display language",
        rightText = 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)
            )
        }
    }
}

Custom Colors

kotlin
SuperArrow(
    title = "Custom Colors",
    titleColor = BasicComponentDefaults.titleColor(
        color = MiuixTheme.colorScheme.primary
    ),
    summary = "Using custom colors",
    summaryColor = BasicComponentDefaults.summaryColor(
        color = MiuixTheme.colorScheme.secondary
    ),
    rightActionColor = RightActionColors(
        color = MiuixTheme.colorScheme.primary,
        disabledColor = MiuixTheme.colorScheme.disabledOnSecondaryVariant
    ),
    onClick = { /* Handle click event */ }
)

Released under the Apache-2.0 License