Package-level declarations

Types

Link copied to clipboard

Canonical artifact directory layout. IDs are path-safe by protocol validation.

Link copied to clipboard
@Serializable
data class PreviewArtifacts(val imagePath: String? = null, val renderTreePath: String? = null, val diagnosticsPath: String? = null)

Files emitted by a successful or partially successful render.

Link copied to clipboard
@Serializable
data class PreviewBuildInput(val kind: PreviewBuildInputKind, val paths: List<String>)

One deterministic, non-empty group of build inputs.

Link copied to clipboard

Stable roles for files exported by the Gradle bridge.

Link copied to clipboard
@Serializable
data class PreviewBuildManifest(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val modulePath: String, val buildVariant: String, val namespace: String, val androidGradlePluginVersion: String, val minSdk: Int, val targetSdk: Int, val compileSdk: Int, val sdkDirectory: String, val mergedManifestPath: String, val artifactRootDirectory: String, val resourcePackageNames: List<String>, val inputs: List<PreviewBuildInput>, val inputFingerprint: String, val layoutlibCompatibilityFingerprint: String = inputFingerprint)

Fully resolved Android build target consumed by discovery, rendering, and IDE tooling.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class PreviewCompositionLocal(val name: String, val value: String)
Link copied to clipboard
@Serializable
data class PreviewCompositionSnapshot(val invalidatedScopeCount: Int = 0, val recomposedScopeCount: Int = 0, val skippedScopeCount: Int = 0, val scopes: List<PreviewRecomposeScope> = emptyList())
Link copied to clipboard
@Serializable
data class PreviewConfiguration(val widthDp: Int = PreviewDefaults.WIDTH_DP, val heightDp: Int = PreviewDefaults.HEIGHT_DP, val density: Float = PreviewDefaults.DENSITY, val fontScale: Float = PreviewDefaults.FONT_SCALE, val localeTags: List<String> = listOf(PreviewDefaults.LOCALE_TAG), val layoutDirection: PreviewLayoutDirection = PreviewLayoutDirection.Ltr, val theme: PreviewTheme = PreviewTheme.Light, val apiLevel: Int? = null)

Fully resolved environment for one static preview render.

Link copied to clipboard
@Serializable
data class PreviewConfigurationAxis(val id: String, val displayName: String, val options: List<PreviewConfigurationOption>)

One independently selectable dimension of a preview matrix.

Link copied to clipboard
@Serializable
data class PreviewConfigurationMatrix(val base: PreviewConfiguration = PreviewConfiguration(), val axes: List<PreviewConfigurationAxis>)

Deterministic Cartesian product used by Gradle, tests, and the IDE variant selector.

Link copied to clipboard
@Serializable
data class PreviewConfigurationOption(val id: String, val displayName: String, val override: PreviewConfigurationOverride)

One named choice on a preview matrix axis.

Link copied to clipboard
@Serializable
data class PreviewConfigurationOverride(val widthDp: Int? = null, val heightDp: Int? = null, val density: Float? = null, val fontScale: Float? = null, val localeTags: List<String>? = null, val layoutDirection: PreviewLayoutDirection? = null, val theme: PreviewTheme? = null, val apiLevel: Int? = null)

Nullable configuration fields used by a matrix option to override a base configuration.

Link copied to clipboard

Reusable axes covering the common first-party static preview configurations.

Link copied to clipboard

Stable defaults shared by annotations, Gradle tooling, and render workers.

Link copied to clipboard
@Serializable
data class PreviewDescriptor(val id: String, val displayName: String, val group: String = "", val entryPoint: PreviewJvmEntryPoint, val variants: List<PreviewVariant>, val sourceLocation: PreviewSourceLocation? = null, val themeProviderClassName: String? = null)

IDE- and renderer-independent description of one preview function.

Link copied to clipboard
@Serializable
data class PreviewDescriptorCatalog(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val modulePath: String, val buildVariant: String, val buildFingerprint: String, val descriptors: List<PreviewDescriptor>, val diagnostics: List<PreviewDiagnostic> = emptyList())

Machine-readable discovery result written even when individual preview functions are invalid.

Link copied to clipboard
@Serializable
data class PreviewDiagnostic(val severity: PreviewDiagnosticSeverity, val message: String, val phase: String, val sourceLocation: PreviewSourceLocation? = null, val details: String? = null)

One structured compile, discovery, render, or export diagnostic.

Link copied to clipboard
@ViewComposePreview(name = "Font 100%", fontScale = 1.0)
@ViewComposePreview(name = "Font 130%", fontScale = 1.3)
@ViewComposePreview(name = "Font 200%", fontScale = 2.0)
annotation class PreviewFontScales

Built-in multi-preview for default, large, and maximum accessibility font scales.

Link copied to clipboard
@Serializable
data class PreviewJvmEntryPoint(val ownerClassName: String, val methodName: String, val methodDescriptor: String? = null)

Compiled JVM function that a render worker invokes for a preview.

Link copied to clipboard
@Serializable
data class PreviewLayoutBounds(val left: Int, val top: Int, val right: Int, val bottom: Int)
Link copied to clipboard
@Serializable
data class PreviewLayoutDiagnostic(val kind: PreviewLayoutDiagnosticKind, val severity: PreviewDiagnosticSeverity, val className: String, val bounds: PreviewLayoutBounds, val visibleBounds: PreviewLayoutBounds? = null, val clippingAncestorClassName: String? = null, val clippingAncestorNodeId: String? = null, val clippingExpected: Boolean = false, val metrics: Map<String, Int> = emptyMap(), val nodeId: String? = null, val sourceCallSites: List<PreviewSourceCallSite> = emptyList(), val synthetic: Boolean = false)

One source-aware layout condition captured after Android measure and layout complete.

Link copied to clipboard

Explicit layout direction used for a deterministic preview render.

Link copied to clipboard

Built-in multi-preview for the framework Light and Dark token sets.

Link copied to clipboard
@ViewComposePreview(name = "LTR · en-US", localeTag = "en-US", layoutDirection = PreviewLayoutDirection.Ltr)
@ViewComposePreview(name = "RTL · ar-EG", localeTag = "ar-EG", layoutDirection = PreviewLayoutDirection.Rtl)
annotation class PreviewLtrRtl

Built-in multi-preview for LTR English and RTL Arabic environments.

Link copied to clipboard
@Serializable
data class PreviewNativeViewNode(val className: String, val bounds: PreviewLayoutBounds, val measuredWidth: Int, val measuredHeight: Int, val visibility: String, val visibleBounds: PreviewLayoutBounds? = null, val clippingState: PreviewClippingState = PreviewClippingState.NotClipped, val clippingAncestorClassName: String? = null, val clippingAncestorNodeId: String? = null, val clippingExpected: Boolean = false, val properties: Map<String, String> = emptyMap(), val nodeId: String? = null, val sourceCallSites: List<PreviewSourceCallSite> = emptyList(), val synthetic: Boolean = false, val children: List<PreviewNativeViewNode> = emptyList())

One laid-out Android View captured after the static preview root completes measure and layout.

Link copied to clipboard
@Serializable
data class PreviewNodeBindingStats(val rebound: Int = 0, val patched: Int = 0, val skipped: Int = 0)
Link copied to clipboard
@Serializable
data class PreviewPatchRecord(val operation: String, val type: String, val key: String? = null, val parentKey: String? = null, val index: Int, val moved: Boolean = false, val detail: String? = null, val nodeId: String? = null, val sourceCallSites: List<PreviewSourceCallSite> = emptyList(), val synthetic: Boolean = false)
Link copied to clipboard
@Serializable
data class PreviewPhaseTiming(val phase: String, val durationMillis: Long)

One deterministic phase measurement emitted by the isolated render pipeline.

Link copied to clipboard
@ViewComposePreview(name = "Phone", widthDp = 411, heightDp = 891)
@ViewComposePreview(name = "Tablet", widthDp = 800, heightDp = 1280)
annotation class PreviewPhoneTablet

Built-in multi-preview for common phone and tablet canvas sizes.

Link copied to clipboard

Canonical JSON codec shared by Gradle, render workers, tests, and the Android Studio plugin.

Link copied to clipboard
@Serializable
data class PreviewRecomposeScope(val path: String, val signature: String, val depth: Int, val reasons: List<String> = emptyList(), val recomposed: Boolean, val skipped: Boolean, val locals: List<PreviewCompositionLocal> = emptyList(), val sourceCallSites: List<PreviewSourceCallSite> = emptyList())
Link copied to clipboard
@Serializable
data class PreviewRenderRequest(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val requestId: String, val descriptor: PreviewDescriptor, val variantId: String, val modulePath: String, val buildVariant: String, val buildFingerprint: String, val outputDirectory: String)

One isolated static render request.

Link copied to clipboard
@Serializable
data class PreviewRenderResponse(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val requestId: String, val previewId: String, val variantId: String, val status: PreviewRenderStatus, val artifacts: PreviewArtifacts? = null, val diagnostics: List<PreviewDiagnostic> = emptyList(), val durationMillis: Long? = null, val phaseTimings: List<PreviewPhaseTiming> = emptyList())

Response returned by an isolated preview worker.

Link copied to clipboard
@Serializable
data class PreviewRenderSnapshot(val stats: PreviewRenderStats = PreviewRenderStats(), val structure: PreviewRenderStructure = PreviewRenderStructure(), val warnings: List<String> = emptyList(), val tree: List<PreviewRenderTreeNode> = emptyList(), val nativeViewTree: List<PreviewNativeViewNode> = emptyList(), val layoutDiagnostics: List<PreviewLayoutDiagnostic> = emptyList(), val patches: List<PreviewPatchRecord> = emptyList(), val composition: PreviewCompositionSnapshot = PreviewCompositionSnapshot())

Platform-neutral diagnostics emitted beside a static preview image.

Link copied to clipboard
@Serializable
data class PreviewRenderStats(val inserts: Int = 0, val reuses: Int = 0, val removals: Int = 0, val reboundNodes: Int = 0, val patchedNodes: Int = 0, val skippedBindings: Int = 0, val skippedSubtrees: Int = 0, val bindingsByType: Map<String, PreviewNodeBindingStats> = emptyMap())
Link copied to clipboard

Stable preview worker outcome. Failures are data rather than thrown across the process boundary.

Link copied to clipboard
@Serializable
data class PreviewRenderStructure(val vnodeCount: Int = 0, val mountedNodeCount: Int = 0, val maxVNodeDepth: Int = 0, val maxMountedDepth: Int = 0)
Link copied to clipboard
@Serializable
data class PreviewRenderTreeNode(val type: String, val key: String? = null, val nodeId: String? = null, val sourceCallSites: List<PreviewSourceCallSite> = emptyList(), val synthetic: Boolean = false, val children: List<PreviewRenderTreeNode> = emptyList())
Link copied to clipboard
@Serializable
data class PreviewSourceCallSite(val className: String, val methodName: String, val fileName: String, val lineNumber: Int)

One JVM line-table call site associated with a preview node.

Link copied to clipboard
@Serializable
data class PreviewSourceLocation(val filePath: String, val line: Int, val column: Int = 1, val symbolName: String? = null)

Source location used for diagnostics and IDE navigation.

Link copied to clipboard
@Serializable
enum PreviewTheme : Enum<PreviewTheme>

Explicit day/night resource mode used for a deterministic preview render.

Link copied to clipboard
@Serializable
data class PreviewVariant(val id: String, val displayName: String, val configuration: PreviewConfiguration)

Named configuration presented as one selectable preview variant.

Link copied to clipboard
@Serializable
data class PreviewWorkerBatchCommand(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val commands: List<PreviewWorkerCommand>)

Bounded collection of isolated render commands executed sequentially by one short-lived host. The host process still exits after the batch, preventing Layoutlib state from leaking into Gradle or Android Studio while avoiding one JVM startup per gallery tile.

Link copied to clipboard
@Serializable
data class PreviewWorkerCommand(val protocolVersion: Int = ViewComposePreviewProtocol.CURRENT_VERSION, val buildManifestPath: String, val renderRequestPath: String, val renderResponsePath: String, val layoutlibRuntimeRoot: String, val layoutlibResourcesRoot: String, val renderClasspath: List<String> = emptyList())

One self-contained command consumed by the isolated Layoutlib host.

Link copied to clipboard
annotation class ViewComposePreview(val name: String = "", val group: String = "", val widthDp: Int = PreviewDefaults.WIDTH_DP, val heightDp: Int = PreviewDefaults.HEIGHT_DP, val density: Float = PreviewDefaults.DENSITY, val fontScale: Float = PreviewDefaults.FONT_SCALE, val localeTag: String = PreviewDefaults.LOCALE_TAG, val layoutDirection: PreviewLayoutDirection = PreviewLayoutDirection.Ltr, val theme: PreviewTheme = PreviewTheme.Light, val apiLevel: Int = PreviewDefaults.UNSPECIFIED_API_LEVEL)

Marks a top-level or static ViewCompose DSL function as a tooling preview entry point.

Link copied to clipboard

Versioned boundary between Gradle/IDE clients and an isolated preview render worker.

Link copied to clipboard

JVM container used for repeatable ViewComposePreview declarations.

Link copied to clipboard

Selects the single application-owned theme provider used by static previews in one module.

Properties

Link copied to clipboard

Whether the screenshot canvas may grow beyond viewportHeightDp.

Link copied to clipboard
Link copied to clipboard

Concrete device height used by Android resources and the first layout pass.

Functions

Link copied to clipboard

Converts annotation values into the resolved, host-independent preview configuration.