Package-level declarations

Types

Link copied to clipboard

Alignment types used in native ad layout containers.

Link copied to clipboard
sealed interface AdAssetNode : AdNode

A node that renders a native ad asset (e.g., headline, icon, media). Each subtype binds to a specific field from the native ad data.

Link copied to clipboard
data class AdButtonStyle(val textStyle: AdTextStyle = AdTextStyle(14f, 0xFFFFFFFF, AdFontWeight.Bold, AdTextAlign.Center), val backgroundArgb: Long = 4279923688, val cornerRadiusDp: Float = 8.0f, val horizontalPaddingDp: Float = 12.0f)

Style configuration for call-to-action buttons in native ad layouts.

Link copied to clipboard
sealed interface AdClip

Clipping shape for an AdModifier.

Link copied to clipboard

Colour roles used in native ad theming.

Link copied to clipboard
sealed interface AdContainerNode : AdNode

A container node that holds child AdNodes in a specific arrangement.

Link copied to clipboard
data class AdContainerStyle(val backgroundArgb: Long? = null, val cornerRadiusDp: Float = 0.0f)

Style configuration for container nodes.

Link copied to clipboard

Content scale mode for images.

Link copied to clipboard

Visibility state for an AdModifier.

Link copied to clipboard

Font weight options.

Link copied to clipboard
data class AdImageStyle(val contentScale: AdContentScale = AdContentScale.Fit, val backgroundArgb: Long? = null)

Style configuration for image assets (icon, media) in native ad layouts.

Link copied to clipboard
data class AdInsets(val startDp: Float = 0.0f, val topDp: Float = 0.0f, val endDp: Float = 0.0f, val bottomDp: Float = 0.0f)

Directional insets for padding or margin in an AdModifier.

Link copied to clipboard
data class AdLayout(val root: AdNode)

An immutable, rendered native ad layout tree. Produced by the adLayout DSL function. validation is computed eagerly and reports any missing policy-required assets (headline, ad badge, AdChoices).

Link copied to clipboard

Builder for the native ad layout DSL. Should only be instantiated via the adLayout top-level function.

Link copied to clipboard
annotation class AdLayoutDsl

DSL marker annotation that restricts lambda receivers in the native ad layout DSL. Ensures builders are scoped correctly and prevents accidental nesting of unrelated DSLs.

Link copied to clipboard
data class AdLayoutPreviewData(val headline: String = "Build faster with sample native ads", val body: String = "Preview your native ad layout with realistic sample copy before wiring live AdMob assets.", val callToAction: String = "Install", val advertiser: String = "AdMob CMP", val price: String = "Free", val store: String = "App Store", val starRating: Double = 4.6, val hasIcon: Boolean = true, val hasMedia: Boolean = true)

Sample data for previewing a native ad layout in AdLayoutPreview. All fields carry realistic defaults suitable for design-time rendering.

Link copied to clipboard
open class AdLayoutScope

Receiver scope for the native ad layout DSL. Provides builder functions for every supported layout node and ad asset.

Link copied to clipboard
sealed interface AdLayoutSize

Sizing strategy for an AdModifier dimension.

Link copied to clipboard
data class AdLayoutValidationIssue(val code: String, val message: String, val nodePath: String)

A single validation issue found during AdLayoutValidator.validate.

Link copied to clipboard
data class AdLayoutValidationReport(val errors: List<AdLayoutValidationIssue> = emptyList(), val warnings: List<AdLayoutValidationIssue> = emptyList())

Result of validating an AdLayout tree. errors are structural problems that prevent rendering; warnings indicate missing policy-relevant assets (headline, ad badge, AdChoices).

Link copied to clipboard

Validates a native AdLayout tree.

Link copied to clipboard
data class AdModifier(val width: AdLayoutSize = AdLayoutSize.Wrap, val height: AdLayoutSize = AdLayoutSize.Wrap, val minWidthDp: Float? = null, val minHeightDp: Float? = null, val padding: AdInsets = AdInsets(), val margin: AdInsets = AdInsets(), val weight: Float? = null, val aspectRatio: Float? = null, val backgroundArgb: Long? = null, val borderWidthDp: Float? = null, val borderColorArgb: Long? = null, val borderRadiusDp: Float? = null, val cornerRadiusDp: Float? = null, val alpha: Float = 1.0f, val maxWidthDp: Float? = null, val maxHeightDp: Float? = null, val offsetXDp: Float = 0.0f, val offsetYDp: Float = 0.0f, val zIndex: Float = 0.0f, val elevationDp: Float = 0.0f, val clipShape: AdClip = AdClip.None, val display: AdDisplay = AdDisplay.Visible)

A serialisable, platform-agnostic analogue of Compose Modifier for native ad layout nodes. Immutable value object — chaining methods return new copies with the applied change.

Link copied to clipboard
sealed interface AdNode

Base type for all nodes in a native ad layout tree. Every node carries an AdModifier for sizing, spacing, and appearance.

Link copied to clipboard
data class AdSpacer(val modifier: AdModifier = AdModifier.empty) : AdNode

An empty spacer node used to create gaps in a layout.

Link copied to clipboard
data class AdStaticText(val text: String, val modifier: AdModifier = AdModifier.empty, val style: AdTextStyle = AdTextStyle.body, val maxLines: Int? = null) : AdNode

A node that displays static (non-ad) text. Useful for labels, headers, or decorative text in native ad layouts.

Link copied to clipboard

Ready-made, policy-compliant native ad layout templates. Each template includes the required ad attribution badge and AdChoices space.

Link copied to clipboard

Text alignment options.

Link copied to clipboard
data class AdTextStyle(val fontSizeSp: Float = 14.0f, val colorArgb: Long = 4280295716, val fontWeight: AdFontWeight = AdFontWeight.Normal, val textAlign: AdTextAlign = AdTextAlign.Start)

Style configuration for text nodes in native ad layouts. Includes font size, colour, weight, and alignment.

Link copied to clipboard

Controls layout behavior when a native ad asset is missing from the creative. HideWhenMissing removes the node entirely, losing its space. InvisibleWhenMissing keeps the space but renders nothing. KeepSpace always reserves the space, even when the asset is absent.

Functions

Link copied to clipboard
fun adLayout(content: AdLayoutBuilder.() -> Unit): AdLayout

Top-level DSL entry point that builds an AdLayout tree. Single-child content becomes the root node; multi-child content is wrapped in a full-width AdContainerNode.Column.

Link copied to clipboard
fun AdLayoutPreview(layout: AdLayout = AdTemplates.mediaCard, modifier: Modifier = Modifier, data: AdLayoutPreviewData = AdLayoutPreviewData.default)

Renders an AdLayout with sample preview data for Compose previews / design-time visualisation. Does not load a real ad. Use this in @Preview composables to verify your native ad layout's appearance.