Skip to content

Instantly share code, notes, and snippets.

@KatieBarnett
Last active April 26, 2024 04:55
Show Gist options
  • Save KatieBarnett/764b4db9cebf85d497a6f0db87701906 to your computer and use it in GitHub Desktop.
Save KatieBarnett/764b4db9cebf85d497a6f0db87701906 to your computer and use it in GitHub Desktop.
LocalInspectionMode - Simple text example
@Composable
fun TextComponent() {
Column(
verticalArrangement = Arrangement.spacedBy(16.dp),
modifier = Modifier.padding(16.dp)
) {
Text(
if (LocalInspectionMode.current) {
"This is only displayed in a preview"
} else {
"This is only displayed in live code"
}
)
Text("This should always be displayed")
}
}
@Preview(showBackground = true)
@Composable
fun TextComponentPreview() {
TextComponent()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment