Skip to content

Image ​

Fixed aspect-ratio media box with rounded corners, an optional bottom gradient scrim for overlaid text, and a bottom-left content slot. There is no network loading here — a muted placeholder glyph stands in for the photo; use Coil/AsyncImage at the call site for real images.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismImage

Basic usage ​

kotlin
PrismImage(ratio = PrismImageRatio.R16x9)

Overlay caption ​

Set overlay = true to add a bottom gradient scrim; the content slot is pinned bottom-left and switches to white text when the overlay is on.

kotlin
PrismImage(overlay = true) {
    Text("Caption")
}

Aspect ratios ​

kotlin
PrismImage(ratio = PrismImageRatio.R1x1)
PrismImage(ratio = PrismImageRatio.R4x3)
PrismImage(ratio = PrismImageRatio.R3x4)

API ​

PrismImage ​

ParameterTypeDefaultDescription
modifierModifierModifierModifier applied to the media box.
ratioPrismImageRatioPrismImageRatio.R16x9Fixed aspect ratio of the box.
radiusDpPrismTheme.radius.imageCorner radius.
overlayBooleanfalseBottom gradient scrim to keep overlaid text legible.
content(@Composable () -> Unit)?nullOverlaid content (e.g. a caption), pinned bottom-left.

PrismImageRatio ​

ValueRatio
R16x916:9
R4x34:3
R1x11:1
R3x43:4

Released under the MIT License.