provideDefaultCompositionLocalFields
fun PreviewLabScope.provideDefaultCompositionLocalFields(densityField: (MutablePreviewLabField<Float>) -> MutablePreviewLabField<Float> = { it }, fontScaleField: (MutablePreviewLabField<Float>) -> MutablePreviewLabField<Float> = { it.withBasicFontScalesHint() }): Array<ProvidedValue<*>>
Provides default Compose composition local fields for PreviewLab.
This function creates interactive fields for commonly used composition locals like:
LocalDensity with customizable density and font scale
LocalLayoutDirection with selectable layout directions
Platform-specific composition locals
Return
Array of ProvidedValue containing the composition local fields.
Usage
@Preview
@Composable
fun MyPreview() = PreviewLab {
CompositionLocalProvider(
*provideDefaultCompositionLocalFields(),
) {
MyComponent()
}
}Content copied to clipboard
Parameters
densityField
Transform function for the density field. Default is identity.
fontScaleField
Transform function for the font scale field. Default adds basic font scale hints.