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

Degree to which a native View's laid-out bounds remain visible.

Link copied to clipboard
@Serializable
data class PreviewCompositionLocal(val name: String, val value: String)

Printable composition-local diagnostic value.

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())

Aggregate recomposition diagnostics for one rendered frame.

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 fields applied by one matrix option over a base configuration.

Link copied to clipboard

Reusable axes covering 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

Portable diagnostic importance interpreted by Gradle and IDE clients.

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)

Integer pixel bounds relative to the preview root.

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

Stable post-layout problem categories understood by IDE clients.

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)

Native-binding counters for one node type.

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)

One portable reconciliation operation captured for diagnostics.

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())

One source-aware composition scope outcome.

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())

Aggregate reconciliation and native-binding counters.

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)

Aggregate sizes and depths of one rendered structure.

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())

Portable recursive representation of one rendered VNode.

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.

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

Maximum render commands accepted by one short-lived worker batch.

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 a validated host-independent configuration.