boxShadow
fun StyleScope.boxShadow(offsetX: CSSLengthNumericValue = 0.px, offsetY: CSSLengthNumericValue = 0.px, blurRadius: CSSLengthNumericValue? = null, spreadRadius: CSSLengthNumericValue? = null, color: CSSColorValue? = null, inset: Boolean = false)(source)
Creates a box-shadow property with a single shadow. The property accepts either the BoxShadow.None value, the default global keywords, which indicates no shadows, or a list of shadows, created by using BoxShadow.of, ordered front to back.
Usages:
style {
boxShadow(BoxShadow.None)
}
Content copied to clipboard
Will generate:
box-shadow: none
Content copied to clipboard
style {
boxShadow(BoxShadow.Unset)
}
Content copied to clipboard
Will generate:
box-shadow: unset
Content copied to clipboard
style {
boxShadow(
BoxShadow.of(
offsetX = 0.px,
offsetY = 1.px,
blurRadius = 3.px,
spreadRadius = 1.px,
color = Colors.Black.copyf(alpha = 0.15f),
),
)
}
Content copied to clipboard
Will generate:
box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 3px 1px;
Content copied to clipboard
See also
Creates a box-shadow property with multiple shadow. The property accepts a list of shadows, created by using BoxShadow.of, ordered from front to back.
The style is not created if no shadows are specified.
Usage:
style {
boxShadow(
BoxShadow.of(
offsetX = 0.px,
offsetY = 1.px,
blurRadius = 3.px,
spreadRadius = 1.px,
color = Colors.Black.copyf(alpha = 0.15f),
),
BoxShadow.of(
offsetX = 5.px,
offsetY = 8.px,
blurRadius = 10.px,
spreadRadius = (-1).px,
color = Colors.Black.copyf(alpha = 0.32f),
),
)
}
Content copied to clipboard
Will generate:
box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 3px 1px,
rgba(0, 0, 0, 0.318) 5px 8px 10px -1px;
Content copied to clipboard