UX4G Logo
Token

Elevation & Shadows

Elevation levels and drop shadow tokens for Android Jetpack Compose

UX4G Shadows create consistent depth hierarchies, layering, and surface separation across mobile screens in Android Jetpack Compose.

All shadow tokens are defined in com.ux4g.designsystemv1.foundation.Ux4gShadow using platform-neutral Ux4gBoxShadow values.


1. Shadow Levels (Ux4gShadow)

Lv 0
shadow0 (Flat)Elevation
0.dp— Flat surfaces, inline items
Ux4gShadow.shadow0
Lv 1
shadow1 (Subtle)Elevation
2.dp— Cards, chips, input fields
Ux4gShadow.shadow1
Lv 2
shadow2 (Floating)Elevation
4.dp— Hovered cards, FABs
Ux4gShadow.shadow2
Lv 3
shadow3 (Prominent)Elevation
8.dp— Sticky headers, bottom nav
Ux4gShadow.shadow3
Lv 4
shadow4 (Highest)Elevation
16.dp— Dialogs, bottom sheets, toast alerts
Ux4gShadow.shadow4

2. Shadow Token Details

Level TokenAliasBox Shadows (Light Mode)Box Shadows (Dark Mode)Typical Component Usage
shadow0flatNoneNoneDividers, flat table rows
shadow1subtle(0, 1dp, 2dp, 4% alpha) x2(0, 1dp, 2dp, 20% alpha)Standard cards, search bar, list items
shadow2floating(0, 1dp, 2dp) + (0, 4dp, 8dp)(0, 1dp, 2dp) + (0, 4dp, 8dp)Floating Action Button (FAB), active card
shadow3prominent(0, 4dp, 8dp) + (0, 0dp, 16dp)(0, 4dp, 8dp) + (0, 0dp, 16dp)App headers, bottom navigation
shadow4highest(0, 8dp, 16dp) + (0, 16dp, 32dp)(0, 8dp, 16dp) + (0, 16dp, 32dp)Modal dialogs, bottom sheets, toast host

3. Kotlin Jetpack Compose Usage

Compose Usage
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.unit.dp
import com.ux4g.designsystemv1.foundation.Ux4gColors
import com.ux4g.designsystemv1.foundation.Ux4gRadius
import com.ux4g.designsystemv1.foundation.Ux4gShadow

// Standard elevation shadow
Box(
    modifier = Modifier
        .shadow(
            elevation = 4.dp, // Level 2 Medium
            shape = RoundedCornerShape(Ux4gRadius.Radius12),
            clip = true
        )
        .background(Ux4gColors.white)
        .padding(16.dp)
) {
    // Card content
}

// Programmatic helper by level
val shadows = Ux4gShadow.get(level = 2, isDark = false)

On this page