---
title: "CanvasOp.DrawConditionally"
description: "Represents a conditional drawing block (drawConditionally)."
type: "class"
lastmod: "2026-07-30T07:35:59.205739Z"
---
## API Reference

> Source set: Android

```kotlin
class DrawConditionally(
        val condition: RemoteBoolean,
        val childSpan: CanvasOperationBuffer.Span,
        val action: (RemoteComposeWriter, RemoteComposeCreationState) -> Unit,
    ) : CanvasOp()
```

Represents a conditional drawing block (`drawConditionally`).

Typically [childSpan](#childspan) will be a `CanvasOperationBuffer.Span`, which if hasChildCommands will
return false if empty.
