Skip to content

Manual Registry

Generated previews are the normal path, but the manual DSL is available when you need:

  • previews not driven by annotations
  • custom parameter surfaces
  • composed registries across modules
  • local registry-specific configuration overrides
val registry = buildRegistry {
group(SampleGroup.Components) {
preview("Greeting Card", group = SampleGroup.Components) {
GreetingPreview()
}
preview(
name = "Profile Card",
group = SampleGroup.Components,
params = previewParams {
string(key = "name", label = "Name", initial = "Jane Doe")
boolean(key = "online", label = "Online", initial = true)
},
) { state ->
ProfileCard(
name = state["name"] ?: "Jane Doe",
online = state["online"] ?: true,
)
}
}
}
val appRegistry = buildRegistry {
include(FeaturePreviews)
include(DesignSystemPreviews)
}

Included registries bring both entries and config overrides.

The DSL is where Composeum can expose richer control surfaces without making the annotation model heavy. Use it when the preview surface itself is part of the tool you are building.