by @alexstyl
✉️ Leave your feedback

← Back to Compose UI

inspectable

Modifier
in
Compose UI
. Since 1.1.0

Overview

Examples

Community Notes

@Composable
fun InspectableModifierSample() {

    /**
     * Sample with a single parameter
     */
    fun Modifier.simpleFrame(color: Color) = inspectable(
        inspectorInfo = debugInspectorInfo {
            name = "simpleFrame"
            value = color
        }
    ) {
        background(color, RoundedCornerShape(5.0.dp))
    }

    /**
     * Sample with multiple parameters
     */
    fun Modifier.fancyFrame(size: Dp, color: Color) = inspectable(
        inspectorInfo = debugInspectorInfo {
            name = "fancyFrame"
            properties["size"] = size
            properties["color"] = color
        }
    ) {
        background(color, RoundedCornerShape(size))
    }
}
Next ComponentAndroidView