Skip to content

Shadows & Elevation

Apply platform-specific shadows and elevation to create depth and visual hierarchy. Automatically uses iOS shadow properties or Android elevation based on the platform.

<View className="shadow-sm" /> // Subtle shadow
<View className="shadow" /> // Default shadow
<View className="shadow-md" /> // Medium shadow
<View className="shadow-lg" /> // Large shadow
<View className="shadow-xl" /> // Extra large shadow
<View className="shadow-2xl" /> // Extra extra large shadow
<View className="shadow-none" /> // Remove shadow
PlatformProperties Used
iOSshadowColor, shadowOffset, shadowOpacity, shadowRadius
Androidelevation
ClassshadowOpacityshadowRadiusshadowOffset
shadow-sm0.051{ width: 0, height: 1 }
shadow0.12{ width: 0, height: 1 }
shadow-md0.154{ width: 0, height: 3 }
shadow-lg0.28{ width: 0, height: 6 }
shadow-xl0.2512{ width: 0, height: 10 }
shadow-2xl0.324{ width: 0, height: 20 }
Classelevation
shadow-sm1
shadow2
shadow-md4
shadow-lg8
shadow-xl12
shadow-2xl16
<View className="bg-white rounded-lg shadow-lg p-6 m-4">
<Text className="text-xl font-bold">Card Title</Text>
<Text className="text-gray-600">Card with large shadow</Text>
</View>
<Pressable className="bg-blue-500 shadow-sm rounded-lg px-6 py-3">
<Text className="text-white">Press Me</Text>
</Pressable>
<View className="shadow-sm p-4 bg-white mb-4 rounded">Subtle</View>
<View className="shadow p-4 bg-white mb-4 rounded">Default</View>
<View className="shadow-md p-4 bg-white mb-4 rounded">Medium</View>
<View className="shadow-lg p-4 bg-white mb-4 rounded">Large</View>
<View className="shadow-xl p-4 bg-white mb-4 rounded">Extra Large</View>
<View className="shadow-2xl p-4 bg-white mb-4 rounded">2X Large</View>
<View className="shadow-lg ios:shadow-none p-4 bg-white rounded">
Shadow only on Android
</View>

All shadow parsing happens at compile-time with zero runtime overhead. The platform detection uses React Native’s Platform.select() API.