# Crow for AI agents (https://crow.build/docs/ai)
Crow is built to be written by agents as much as by people. These docs, the skills and the `crow` CLI all have a form an agent can read and drive directly.
## Ask AI [#ask-ai]
Every docs page has an **Ask AI** button. It answers only from these docs, searches them for you, and links the pages it used.
## Every page as Markdown [#every-page-as-markdown]
- **Add `.md` to any docs URL** for its Markdown, for example [`/docs/quickstart.md`](/docs/quickstart.md).
- **Copy Markdown** at the top of each page copies it, ready to paste into an agent. **Open** sends the page to a chat assistant.
## llms.txt [#llmstxt]
| File | What it is |
|---|---|
| [`/llms.txt`](/llms.txt) | An index of every page with a one-line summary and a link to its Markdown. Give this to an agent first. |
| [`/llms-full.txt`](/llms-full.txt) | All of the docs in one Markdown file, for agents that load everything up front. |
## Agent skills [#agent-skills]
Crow ships seven [Agent Skills](https://agentskills.io) (`SKILL.md` folders) that teach an agent Crow's APIs, compiler rules and conventions. They live in the Crow repository under `.agents/skills/`. Copy the ones you need into your project's skills folder (for example `.agents/skills/` or `.claude/skills/`).
| Skill | Use it for |
|---|---|
| `crow-core` | `@Ui` components, signals, compiler diagnostics (`CR1001`–`CR1003`), layouts, modifiers, lazy lists, pagers, text, input, insets, drawing, shaders and motion |
| `crow-app` | Structuring an app: feature packages, import rules, where state lives, a testable root, ownership and anti-patterns |
| `crow-data` | Async data, `crow-query` caching, `crow-store` persistence, `crow-schema` validation and forms, saved state, `crow-inject` |
| `crow-design-systems` | Styling and theming: unstyled components, Material 3, Lens, Material Symbols, color and contrast, TalkBack semantics |
| `crow-navigation` | File-based routing, back stacks, transitions, shared elements, predictive back, sheets, dialogs, popups and guided tours |
| `crow-testing` | Headless UI tests, PNG snapshots, accessibility checks, reactive leak assertions and emulator checks |
| `crow-contributing` | Contributing to the Crow repository itself |
## The Crow MCP server [#the-crow-mcp-server]
`crow mcp` runs a [Model Context Protocol](https://modelcontextprotocol.io) server over stdio, backed by the same warm daemon as the `crow` CLI. An agent can build, test, read diagnostics, drive the running app and see it, without shell glue.
```json title="MCP client config"
{
"mcpServers": {
"crow": { "command": "crow", "args": ["mcp", "--project", "."] }
}
}
```
| Tool | What it does |
|---|---|
| `crow_build` | Builds the APK without Gradle (debug or release, optional R8) |
| `crow_test` | Runs headless `@Test` suites without Gradle |
| `crow_diagnostics` | A fast K2 + Crow compiler check (`CR1001`–`CR2007`) without packaging |
| `crow_hot_reload` | Pushes a code change to the running app, keeping its state |
| `crow_snapshot` | The live UI tree |
| `crow_act` | Taps (by node, text or position), types, scrolls and goes back |
| `crow_screenshot` | A screenshot of the running app |
| `crow_inspect_signals` | The live signal dependency graph |
| `crow_trace` | A reactive and frame-timing trace |
# Async, Resources & Held Transitions (https://crow.build/docs/core/async)
Crow treats asynchronous data as a first-class graph primitive rather than a pile of ad-hoc `Loading | Success | Error` sealed classes in a ViewModel.
## Resources & Boundaries [#resources--boundaries]
Declare an async computation tied to the active `Owner` with `resource`:
```kotlin
@Ui
fun UserProfile(userId: String) {
val profile = resource(key = { userId }) { id ->
api.fetchUser(id)
}
Errored(fallback = { error, retry ->
ErrorCard(message = error.message ?: "Failed", onRetry = { profile.reload(); retry() })
}) {
Loading(fallback = { ProfileSkeleton() }) {
// Reading `profile.value` in a live prop suspends Loading until the first value arrives
ProfileContent(profile.value, refreshing = profile.isPending)
}
}
}
```
### How `Loading` & `Errored` Work [#how-loading--errored-work]
- **Cold load**: When `profile()` is read before its first value resolves, `NotReady` marks the enclosing `Loading` boundary. The content tree mounts into a hidden region while the fallback displays, then **reveals atomically in a single frame** once ready.
- **Stale-run cancellation**: If `userId` changes while a fetch is in flight, superseded runs are cancelled and ignored automatically.
- **Error recovery**: Exceptions inside the resource or during build route to the nearest `Errored` boundary with a `retry()` callback.
## Held Transitions (Two Consistent Views) [#held-transitions-two-consistent-views]
Once a resource has a value, changing its key does **not** flash back to the `Loading` skeleton!
Instead, Crow enters a **held transition**:
1. The write that triggered the reload is held in a provisional view alongside the pending resource.
2. Any UI binding depending on the held state keeps displaying the **previous committed output** — zero half-updated frames, zero spinner flicker.
3. `profile.isPending` is a `Lane.Immediate` signal, so you can show a subtle top progress bar or dim indicator immediately.
4. Direct-manipulation inputs (`Lane.Immediate`, like typing in a search box) update right away without waiting on the network.
5. When the resource (or a whole chain of dependent resources) settles, the entire graph commits in **one atomic flush**.
## Actions & Optimistic UI [#actions--optimistic-ui]
Mutations run inside `action { ... }`, which stages all signal writes transactionally until the coroutine completes:
```kotlin
val displayedLikes = optimistic(likedIds)
val toggleLike = action { postId: String ->
// Visible everywhere immediately while the request is in flight
displayedLikes.set(likedIds.value + postId)
val updated = api.likePost(postId)
// Staged write: applied atomically when the action completes,
// removing the optimistic overlay in the same batch (zero flicker).
likedIds.value = updated
}
```
- **Automatic rollback**: If the network request throws or is cancelled, all staged writes and `optimistic` overlays vanish automatically.
- **`until { condition }`**: Suspends on the **authoritative view** (ignoring optimistic overlays and staged writes), so an optimistic update never falsely acknowledges itself.
- **Verified**: Crow's async transition and action engine is verified against a naive reference model by the E3 fuzzer across 50,000+ randomized interleaving seeds.
For full caching, deduplication, pagination, and background revalidation, see [`crow-query`](/docs/stack/query).
# Inside the K2 Compiler (https://crow.build/docs/core/compiler)
Crow's runtime performance isn't magic — it's **Kotlin K2 compiler lowering**. You write idiomatic declarative Kotlin; `crow-compiler` eliminates nearly all reactive-graph allocation and closure overhead before R8 even sees your bytecode.
## The Five Lowering Passes [#the-five-lowering-passes]
### 1. FIR Static Analysis & Safety Checks (`CR1001`–`CR1003`) [#1-fir-static-analysis--safety-checks-cr1001cr1003]
During Kotlin's Frontend IR phase, Crow checks every `@Ui` body for:
- **`CR1001`**: Bare reactive reads (`Signal`, `Derived`, `Resource`, `Animatable`, live props) inside plain `val` initializers or non-reactive statements.
- **`CR1002`**: Direct writes to reactive state inside a `@Ui` body.
- **`CR1003`**: Storing `@Ui` function types in class fields or constructor parameters.
- **Static vs. live purity**: Deciding deterministically from FIR whether an argument can ever change across incremental builds.
### 2. `$ui` Scope Threading & Dual-Slot Props [#2-ui-scope-threading--dual-slot-props]
Every `@Ui` function receives an implicit `$ui: UiScope` parameter, and every non-`@Once` parameter gets a paired prop-getter slot (specialized for primitives like `IntProp`, `FloatProp`, `BooleanProp` to avoid boxing). Static call sites pass raw values with `null` getters — zero lambdas, zero bindings.
### 3. `LocalGraph` Lowering [#3-localgraph-lowering]
Top-level `var x by signal(init)` declarations inside a `@Ui` function are lowered into **fields of a single generated `LocalGraph` subclass** per component instance, with tracking-aware `get$x` / `set$x` accessors (including action staging support). Instead of allocating separate `SignalNode` objects and links, a component with 4 local signals allocates **one** graph object.
### 4. Modifier Fusion & Binding Fusion [#4-modifier-fusion--binding-fusion]
At inline containers (`Box`, `Row`, `Column`, `Text`), built-in `@IntrinsicModifier` chains fuse directly into sequential field writes on the `LNode` — zero `Modifier` chain objects, zero boxed `Dp`s, zero per-container scope objects (scopes are pooled per tree depth).
When a `@BoundTo` leaf argument (like `Text("$count likes")` or `Modifier.background(if (liked) Red else Gray)`) reads only component-local state at a once-per-instance site, **binding fusion** stores the target node directly in a field of the `LocalGraph` and emits an inline `update(mask)` method. No `BindingNode`, no `Link`, no getter closure.
### 5. Thunk Tables & Zero-Key `saved()` [#5-thunk-tables--zero-key-saved]
- **Thunk tables**: When a component passes multiple dynamic expressions, Crow groups them into one `when (id)` table closure per value kind instead of one synthetic class per argument — keeping DEX method count flat from 10% to 60% dynamic arguments (**0.79× Compose DEX size** in E2).
- **Zero-key `saved()`**: `var query by saved("")` automatically receives a compiler-synthesized declaration-scoped key, so state survives Android process death without manual string keys.
## What the Bytecode Looks Like [#what-the-bytecode-looks-like]
Write this declarative row component:
```kotlin
@Ui
fun FeedRow(title: String, @Once initialLikes: Int) {
var liked by signal(false)
var likes by signal(initialLikes)
Row(Modifier.fillMaxWidth().clickable { likes++ }.padding(16.dp)) {
Text("$likes likes")
Box(
Modifier
.size(24.dp)
.background(if (liked) LikedRed else Gray, CircleShape)
.clickable { liked = !liked },
)
}
}
```
After `LocalGraph` lowering + modifier fusion + binding fusion, `crow-compiler` emits the exact shape a hand-optimized imperative engineer would write:
```kotlin
// Conceptual lowered shape generated by crow-compiler (K2 IR)
private class FeedRow$Graph(initialLikes: Int) : LocalGraph() {
var liked: Boolean = false
var likes: Int = initialLikes
lateinit var textNode: TextNode
lateinit var dotNode: LNode
override fun update(dirtyMask: Int) {
if (dirtyMask and MASK_LIKES != 0) textNode.setText("$likes likes")
if (dirtyMask and MASK_LIKED != 0) dotNode.setBackgroundColor(if (liked) LikedRed else Gray)
}
}
```
On a Snapdragon 695 phone, the compiler-generated 1,000-row screen matches hand-written imperative Crow UI code in memory (**1,309 KB vs 1,317 KB** Java heap, −2.6 KB in class-histogram heap dumps) and mounts with **0 / 25 GC pauses**.
# Components, Props & Control Flow (https://crow.build/docs/core/components)
In Crow, every UI building block is a plain Kotlin function annotated with `@Ui`. Because components run once at mount, reactivity flows through **live props**, **reactive modifiers**, and **compiler-lowered control flow**.
## `@Ui` Functions & Live Props [#ui-functions--live-props]
Every parameter of a `@Ui` function is **live by default**:
```kotlin
@Ui
fun StatusBadge(label: String, active: Boolean, @Once onTap: () -> Unit) {
Box(
Modifier
.clip(RoundedCornerShape(999.dp))
.background(if (active) AccentViolet else MutedSurface)
.clickable(onTap)
.padding(horizontal = 12.dp, vertical = 6.dp),
) {
Text(label)
}
}
```
When a caller passes `StatusBadge(label = user.name, active = isOnline, onTap = ::openProfile)`:
- `label` and `active` compile to **dual-slot props** (a raw value when the caller passes a constant, or a typed getter slot when the caller passes a reactive expression).
- Reading `label` or `active` inside `Text(...)` or `Modifier.background(...)` binds straight to the underlying render node.
- `@Once` marks a parameter as static-only (`onTap`, controllers, stores, route keys) — the compiler skips prop-getter generation completely and lets you read it freely inside the component body without triggering `CR1001`.
### `@Ui` Lambda Props [#ui-lambda-props]
Parameters of a `@Ui` lambda (`itemContent: @Ui (Item) -> Unit`) are **also live props**. Lists (`For`, `LazyColumn`) and `NavHost` use this so when an item's data changes without changing its key, the lambda does **not** remount — the existing nodes update in place.
## Reactive `@Props` Modifiers [#reactive-props-modifiers]
Modifier factories annotated with `@Props` (like `Modifier.background(color)`, `Modifier.height { ... }`, `Modifier.graphicsLayer { ... }`) accept live reactive expressions without taking a UI scope:
```kotlin
Box(
Modifier
.fillMaxWidth()
.height { if (expanded) 180.dp else 64.dp }
.background(if (selected) ActiveTint else SurfaceTint, RoundedCornerShape(16.dp)),
)
```
- Color changes update the **draw phase only** (no layout pass).
- `graphicsLayer { alpha = ...; scale = ... }` updates the **layer phase only** (no tree walk, no draw recording).
- `height { ... }` / `width { ... }` re-measures only in the **layout phase** with zero remounting.
## Reactive Control Flow (`if` / `when`) [#reactive-control-flow-if--when]
You write ordinary Kotlin `if` and `when` statements inside `@Ui` functions:
```kotlin
@Ui
fun ProfileHeader(isPro: Boolean, tier: Tier) {
if (isPro) {
ProBadge()
}
when (tier) {
Tier.Free -> UpgradeBanner()
Tier.Team -> TeamSeatsBar()
Tier.Enterprise -> AuditLink()
}
}
```
At compile time, `crow-compiler` inspects the condition:
1. **Dynamic condition** (reads a signal or live prop): lowers to `uiSwitch`, mounting the active branch inside an isolated **region** with its own `Owner`. Switching branches disposes the outgoing owner and mounts the incoming branch in place without touching sibling nodes.
2. **Static condition** (`@Once` parameter or plain `val`): compiles to an ordinary Kotlin branch with zero region or owner overhead.
## Keyed Lists (`For`) [#keyed-lists-for]
For non-virtualized dynamic collections (chips, form rows, tags, small sections), use `For` with a stable key:
```kotlin
For(tags, key = { it.id }) { tag ->
TagChip(
label = tag.name,
selected = tag.selected,
onClick = { toggleTag(tag.id) },
)
}
```
- Each key gets its own **ordered region** and `Owner`.
- Reordering moves only items outside the longest increasing subsequence — local state inside each row survives moves intact.
- Updating an item's fields delivers the new value as a live prop to the existing entry without remounting it.
- For large scrollable feeds, use [`LazyColumn` / `LazyVerticalGrid`](/docs/ui/lists).
# Signals & Reactivity (https://crow.build/docs/core/reactivity)
`crow-signals` is Crow's platform-free reactive kernel (inspired by SolidJS 2.0 and verified by a 100,000-seed differential fuzzer). Every piece of dynamic UI, async data, styling, and animation in Crow builds on four primitives: **signals**, **derived values**, **effects**, and **owners**.
## Signals [#signals]
Create local or shared reactive state with `signal(initial)`. In a `@Ui` function, top-level `var x by signal(init)` declarations are compiled by K2 into fields of a single generated `LocalGraph` class — zero per-signal heap overhead.
```kotlin
@Ui
fun LikeRow(title: String, @Once initialCount: Int, avatar: Int) {
var liked by signal(false)
var count by signal(initialCount)
Row(
Modifier
.fillMaxWidth()
.clickable { count++ }
.padding(horizontal = 16.dp, vertical = 8.dp),
) {
Box(Modifier.size(40.dp).background(avatar, CircleShape))
Column(Modifier.weight(1f).padding(start = 12.dp)) {
Text(title)
Text("$count likes")
}
Box(
Modifier.size(48.dp).clickable { liked = !liked },
contentAlignment = Alignment.Center,
) {
Box(Modifier.size(24.dp).background(if (liked) LikedRed else Gray, CircleShape))
}
}
}
```
### Equality & Lanes [#equality--lanes]
- **Structural equality by default**: `signal(value, equality = Equality.Structural)` compares with `==` and short-circuits downstream work when values are equal. Use `Equality.Referential` (`===`) or `Equality.Never` when needed.
- **Synchronous reads, batched reactions**: Writing `count++` updates the value immediately — reading `count` or any derived value on the next line returns the new value. UI bindings and effects run in a coalesced `flush()`.
- **Lanes**: Signals default to `Lane.Default` (they participate in held async transitions). Direct-manipulation state (text carets, gestures, springs) uses `Lane.Immediate`, so typing or dragging never stalls while async data loads.
## Derived Values [#derived-values]
Compute memoized values with `val x by { ... }` (delegating to `derived { ... }`):
```kotlin
var price by signal(24.0)
var quantity by signal(2)
val subtotal by { price * quantity }
val formatted by { "$${"%.2f".format(subtotal)}" }
```
Derived values pull lazily when read, cache their output, and only notify downstream bindings when their result actually changes (structural equality). Pass `derived(lazy = true) { ... }` when you want a computation to detach while unobserved.
## Split Effects & Reactions [#split-effects--reactions]
Side effects in Crow are **split into two lambdas**: `track` (pure reads that declare dependencies) and `run` (untracked body that receives `(value, previous)` and may register cleanups or write signals):
```kotlin
effect(track = { userId }) { id, prevId ->
val subscription = analytics.observeUser(id)
onCleanup { subscription.close() }
}
```
| Primitive | When it runs | Typical use |
| --- | --- | --- |
| `effect(track) { v, prev -> }` | After flush settles, deferred while owner is dormant | Analytics, listeners, external I/O |
| `renderEffect(track) { v, prev -> }` | Immediately at mount and before user effects | Internal UI bindings and host sync |
| `reaction(onInvalidate)` | On-demand tracking via `Reaction.track { }` | Custom `Canvas` / `drawBehind` invalidation |
| `onSettled { }` | Once after the current flush settles | Post-commit callbacks |
## Owners & Lifetime [#owners--lifetime]
Every `setContent`, reactive `if`/`when` branch, `For` item, `LazyColumn` row, `Overlay`, and `NavHost` entry creates an **`Owner`**.
- Effects, resources, and `onCleanup { }` callbacks automatically bind to the active owner.
- When a branch leaves or a screen pops, its owner disposes children first, then runs cleanups in LIFO order.
- Dormant owners (such as a covered screen in `BackStack` `keepAlive`) defer user effects until the screen returns to the foreground, while keeping bindings intact.
- Outside UI code, create owners manually with `root { dispose -> ... }` or `detachedRoot { dispose -> ... }`.
## Compile-Time Guards (`CR1001`, `CR1002` & `CR1003`) [#compile-time-guards-cr1001-cr1002--cr1003]
Crow's K2 FIR checkers eliminate the classic fine-grained reactivity footguns before your app even compiles:
- **`CR1001` — Frozen reactive read**: Reading a signal, `Resource`, `Animatable`, or live prop inside a plain `val` in a `@Ui` body is a compile error. Fix it with `val x by { ... }` (reactive) or `untrack { ... }` (explicit one-time snapshot).
- **`CR1002` — Write during UI build**: Mutating a signal directly inside a `@Ui` body is rejected at compile time. Perform writes in click handlers, `effect` bodies, or coroutines on `Dispatchers.Crow`.
- **`CR1003` — `@Ui` lambda in class field**: Storing a `@Ui () -> Unit` function type in a class property or constructor parameter is rejected at compile time. Pass `@Ui` lambdas as parameters to `@Ui` functions instead.
# Saved State & @CrowApp (https://crow.build/docs/core/saved-state)
Android can kill your background process at any moment. Crow eliminates `SavedStateHandle`, manual Bundle keys, and boilerplate `Activity`/`Application` classes.
## Zero-Key `saved()` [#zero-key-saved]
Replace `signal(initial)` with `saved(initial)` for any UI state that should survive configuration changes and OS process death:
```kotlin
@Ui
fun SearchScreen() {
var query by saved("")
var selectedCategory by saved("all")
var recentSearches by saved(listOf("Kotlin", "Crow"))
// Use them identically to signal() — compiled into fine-grained state
// and automatically persisted to the saved-state Bundle.
}
```
`crow-compiler` synthesizes a stable, declaration-scoped key for every `saved()` call automatically — no hand-written string keys required. When mounting repeated stateful instances (such as inside a `For` loop or shared tab component), wrap each instance in `savedKey("section") { ... }` or use `savedState("custom_key", initial)`.
## Zero-Boilerplate Entry Point with `@CrowApp` [#zero-boilerplate-entry-point-with-crowapp]
With the `crow.app` Gradle plugin, you annotate your root `@Ui` function with `@CrowApp`. Crow generates a zero-AndroidX `CrowActivity` and `CrowApplication`, wires edge-to-edge insets, predictive back, saved state, and your manifest `` automatically.
```kotlin title="AppEntry.kt"
@CrowApp(label = "Notes", process = NotesStore::class)
@Ui
fun NotesApp(@Once store: NotesStore) {
NotesRoot(store = store)
}
```
### Progressive Process Tiers [#progressive-process-tiers]
Choose exactly as much process control as your app needs:
| Tier | How you declare it | What you get |
| --- | --- | --- |
| **Tier 1** | `@CrowApp(label = "MyApp")` | Generated `CrowActivity` & manifest, zero boilerplate |
| **Tier 2A** | `@CrowApp(label = "MyApp", process = AppStore::class)` | Process-scoped object created once per OS process and injected into your root `@Ui` |
| **Tier 2B** | Standalone `@CrowApplication` | Custom process bootstrap shared across Activities, Workers, and Services |
| **Tier 3** | Subclass `CrowApplication` / `CrowActivity` | Full manual hooks when integrating legacy Android SDKs |
## `ProcessHost` [#processhost]
Every `@CrowApp` exposes a `ProcessHost` with:
- **`isForeground: Read`** — reactive foreground/background signal with zero AndroidX `ProcessLifecycleOwner` dependency.
- **`isMainProcess` & `processName`** — zero-IPC process identity checks.
- **`ProcessKey`** — a thread-safe capability registry (`getOrPut`) for sharing stores, query clients, and platform services across your app.
- **`TestAppHost` & `TestProcessHost`** — deterministic drop-in fakes for JVM unit tests.
For durable disk persistence of app data and preferences across cold kills, pair `@CrowApp(process = ...)` with [`crow-store`](/docs/stack/store).
# Lens Liquid Glass (crow-lens) (https://crow.build/docs/design-systems/lens)
**Lens** (`crow-lens`) is Crow's signature modern design system: combining **shadcn's composable, variant-driven clarity**, **Apple HIG typography and hierarchy**, and a **zero-wiring Liquid Glass engine** built directly into Crow UI's renderer.
## Zero-Wiring Liquid Glass [#zero-wiring-liquid-glass]
Most Android blur and glass libraries force you to wire source/backdrop modifiers up and down your view hierarchy (`hazeSource` / `hazeChild`).
Crow's glass engine needs **zero wiring**: Crow UI's renderer already knows what is drawn beneath every surface. Any glass surface automatically samples the live backdrop behind it with:
- **Any-shape SDF refraction** with continuous corners
- **Specular Fresnel rim lighting** & subtle chromatic dispersion
- **Tilt & touch-reactive specular highlights**
- **Adaptive label contrast** that keeps text readable over shifting imagery
- **Liquid merging groups** & **morphing IDs**
- **Interactive swell & stretch** on press and drag
- **Reduced-resolution blur pass** for smooth 120 Hz framing
## Components [#components]
Lens ships typed, variant-driven components built over Crow's unstyled bases:
```kotlin
@Ui
fun BrewSheetActions(@Once onCancel: () -> Unit, @Once onSave: () -> Unit) {
Row(
Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 10.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Button(
onClick = onCancel,
variant = ButtonVariant.Ghost,
size = ButtonSize.Sm,
) {
Text("Cancel")
}
Text("Log Brew", style = Lens.typography.headline)
Button(
onClick = onSave,
variant = ButtonVariant.Default,
size = ButtonSize.Sm,
) {
Text("Save")
}
}
}
```
### Highlights in `crow-lens` [#highlights-in-crow-lens]
- **Floating Liquid Glass `TabBar`** — hosts tabs plus an optional floating glass action orb, automatically morphing its active selection pill.
- **Detent `Sheet`** — glass bottom sheets with fractional detents (`SheetDetent.Fraction(0.62f)`, `SheetDetent.Large`), scroll handoff, swipe-away dismissal, and predictive back.
- **Grouped Controls** — `ListGroup`, `ListRow`, `ListTextField`, `TextArea`, `SegmentedControl`, `Stepper`, `Button` (`Default`, `Secondary`, `Destructive`, `Outline`, `Ghost`, `Link`, `Glass`, `GlassProminent`), arrowed glass popovers, and `ToasterState` stacking notifications.
- **Typography & Tokens** — `Lens.typography` (`largeTitle`, `title1`–`title3`, `headline`, `body`, `callout`, `subheadline`, `footnote`, `caption1`–`caption2`) with Apple-inspired semantic label hierarchy.
# Material 3 (crow-material3) (https://crow.build/docs/design-systems/material3)
`crow-material3` is an **optional design system** built strictly on top of Crow core's public API (`checkCoreIndependence` and `checkDesignSystemHygiene` enforce this boundary in CI).
## Live `MaterialTheme` & Dynamic Color [#live-materialtheme--dynamic-color]
`ColorScheme` is backed by fine-grained signals. Calling `colorScheme.applyFrom(...)` recolors only the exact nodes bound to changed color roles — **zero remounting, zero state loss**, with OKLab color transitions where styled:
```kotlin
@Ui
fun AppRoot() {
val context = appContext()
val scheme = rememberSystemColorScheme(
light = { dynamicLightColorScheme(context) },
dark = { dynamicDarkColorScheme(context) },
)
MaterialTheme(colorScheme = scheme) {
Surface(Modifier.fillMaxSize()) {
MainContent()
}
}
}
```
On Android 12+ (API 31+), `dynamicLightColorScheme(context)` and `dynamicDarkColorScheme(context)` derive Material's full 48-role palette directly from the user's wallpaper and follow live system theme changes automatically.
## Component Catalog [#component-catalog]
Every Material 3 component wraps a core unstyled base (`ButtonBase`, `ToggleBase`, `Overlay`, `ScaffoldBase`) with composable `crow-style` styles:
- **Buttons & Actions**: `Button`, `FilledTonalButton`, `OutlinedButton`, `TextButton`, `IconButton`, `FloatingActionButton`, `SmallFloatingActionButton`, `ExtendedFloatingActionButton`, `SingleChoiceSegmentedButtonRow`, `MultiChoiceSegmentedButtonRow`, `SegmentedButton`
- **Selection & Input**: `Switch`, `Checkbox`, `RadioButton`, `Slider`, `TextField`, `OutlinedTextField` (floating notched label, prefix/suffix, error, password), `AssistChip`, `FilterChip`, `InputChip`
- **Surfaces & Navigation**: `Scaffold`, `NavigationSuiteScaffold`, `TopAppBar` (collapsing Medium/Large), `NavigationBar`, `NavigationRail`, `ModalNavigationDrawer`, `Surface` (tonal elevation), `Card`, `ElevatedCard`, `OutlinedCard`, `HorizontalDivider`, `ListItem`, `PrimaryTabRow`, `SecondaryTabRow`, `ScrollableTabRow`, `Badge`
- **Feedback & Overlays**: `AlertDialog`, `ModalBottomSheet`, `DropdownMenu`, `Snackbar`, `PlainTooltip`, `RichTooltip`, `PullToRefreshBox`, `LinearProgressIndicator`, `CircularProgressIndicator` (allocation-free `drawBehind`)
## Customizing Any Component with `+` [#customizing-any-component-with-]
Because every component's look is a `crow.style.Style` value, overriding a button or chip never requires forking the component:
```kotlin
Button(
onClick = { submit() },
style = style { shape(RoundedCornerShape(10.dp)) },
) {
Text("Continue")
}
```
# Symbols & Variable Icons (crow-symbols) (https://crow.build/docs/design-systems/symbols)
`crow-symbols` puts **all 3,893 Material Symbols** at your fingertips with type-safe Kotlin references, animated variable font axes, expressive icon effects, and automatic build-time font subsetting.
## Usage [#usage]
Import any symbol directly (tree-shaken by R8):
```kotlin
import crow.symbols.Symbols
import crow.symbols.rounded.LocalCafe
import crow.ui.Icon
import crow.ui.SymbolStyle
Icon(
symbol = Symbols.Rounded.LocalCafe,
size = 24.dp,
style = if (selected) SymbolStyle(weight = 600f, fill = 1f) else SymbolStyle.Regular,
)
```
### Live Variable Font Axes [#live-variable-font-axes]
`Icon` drives the real variable-font axes (**fill**, **weight 100–700**, **grade**, and **optical size**) reactively via `SymbolStyle` — morphing seamlessly between outlined (`fill = 0f`) and filled (`fill = 1f`) or light and bold weights with zero asset swapping.
### Three Styles + Soft Preset & Custom SVG Sets [#three-styles--soft-preset--custom-svg-sets]
- `Symbols.Rounded.*`, `Symbols.Outlined.*`, and `Symbols.Sharp.*`, plus `SymbolStyle.Soft` for soft-corner styling on any symbol.
- Import external SVG icon sets cleanly via `svgSymbol(...)`.
- **SF-Symbols-inspired effects**: Built-in `SymbolEffect.Bounce`, `Wiggle`, `Spin`, `Pulse`, and `Breathe` icon effects plus smooth replace transitions when switching between two symbols.
## Automatic Font Subsetting (14.9 MB → 182 KB) [#automatic-font-subsetting-149-mb--182-kb]
Shipping full variable icon fonts would bloat your APK by ~14.9 MB. Crow's self-contained build-time subsetter (`gradle/symbol-fonts.gradle.kts`) scans the exact symbols your app references and emits a tight subsetted font automatically — shrinking 14.9 MB down to **182 KB** in the e1 demo (28 symbols), with an automated build check confirming every referenced glyph is present.
# Coming from Jetpack Compose (https://crow.build/docs/from-compose)
If you already know Jetpack Compose, you can read and write Crow in minutes. Crow intentionally keeps Compose's authoring vocabulary (`Column`, `Row`, `Box`, `Modifier`, `LazyColumn`, `MaterialTheme`) while replacing the execution model underneath.
## The One Mental-Model Shift [#the-one-mental-model-shift]
In Jetpack Compose, a `@Composable` function is a **template that re-executes** whenever state it reads changes. Every `remember`, `derivedStateOf`, `LaunchedEffect`, stability annotation, and deferred-lambda trick exists to work around function re-execution.
In Crow, a `@Ui` function is a **setup block that runs once**.
| Concept | Jetpack Compose | Crow |
| --- | --- | --- |
| Component declaration | `@Composable fun Card(...)` | `@Ui fun Card(...)` |
| Local state | `var n by remember { mutableIntStateOf(0) }` | `var n by signal(0)` |
| Survives process death | `var q by rememberSaveable { mutableStateOf("") }` | `var q by saved("")` |
| Derived state | `val doubled by remember { derivedStateOf { n * 2 } }` | `val doubled by { n * 2 }` |
| Side effects | `LaunchedEffect(key) { ... }` / `DisposableEffect` | `effect({ key }) { v, prev -> onCleanup { ... } }` |
| Conditional UI | Plain `if (cond)` (re-runs whole scope) | Reactive `if (cond)` (lowered to a scoped region) |
| Keyed lists | `items(list, key = { it.id })` / `forEach` | `For(list, key = { it.id })` / `LazyColumn` |
| Static prop hint | `@Immutable` / `@Stable` annotations | `@Once` on props that never change |
| CompositionLocal | `compositionLocalOf { ... }` | `contextOf(...)` (owner-tree scoped) |
| Async loading | Manual `UiState` sealed class + ViewModel | `resource` / `crow-query` + `Loading` / `Errored` |
## Why `remember` Disappears [#why-remember-disappears]
Because `@Ui` functions run once, local variables already live for the lifetime of the component instance. You never wrap signals, controllers, or lambdas in `remember { ... }`.
```kotlin
@Ui
fun SearchBar(@Once onSearch: (String) -> Unit) {
val query = saved("")
val trimmed by { query.value.trim() }
val canSubmit by { trimmed.isNotEmpty() }
Row(Modifier.fillMaxWidth().padding(16.dp)) {
OutlinedTextField(
value = query,
placeholder = { Text("Search...") },
modifier = Modifier.weight(1f),
)
Button(
onClick = { onSearch(trimmed) },
enabled = canSubmit,
) {
Text("Go")
}
}
}
```
```kotlin
@Composable
fun SearchBar(onSearch: (String) -> Unit) {
var query by rememberSaveable { mutableStateOf("") }
val trimmed by remember { derivedStateOf { query.trim() } }
val canSubmit by remember { derivedStateOf { trimmed.isNotEmpty() } }
Row(Modifier.fillMaxWidth().padding(16.dp)) {
OutlinedTextField(
value = query,
onValueChange = { query = it },
placeholder = { Text("Search...") },
modifier = Modifier.weight(1f),
)
Button(
onClick = { onSearch(trimmed) },
enabled = canSubmit,
) {
Text("Go")
}
}
}
```
## The Compiler Has Your Back [#the-compiler-has-your-back]
The single mistake Compose developers make on day one is writing a plain `val` that reads a signal:
```kotlin
var count by signal(0)
val doubled = count * 2 // ❌ Compile Error CR1001!
```
Because the body runs once, `val doubled = count * 2` would freeze `0` forever. Crow's K2 FIR checker catches this at compile time (`CR1001`) and tells you to write either:
- `val doubled by { count * 2 }` — reactive derived value
- `val initial = untrack { count * 2 }` — explicit one-time snapshot
Similarly, mutating a signal directly inside a `@Ui` body is caught at compile time (`CR1002`).
## Greenfield Android, Native Escape Hatch [#greenfield-android-native-escape-hatch]
Crow is built for greenfield Android apps that want zero recomposition, zero ViewModel ceremony, and zero AndroidX glue. When you need a legacy Android `View` (such as a `WebView`, `SurfaceView`, or third-party SDK view), embed it directly in any Crow layout with `NativeView` from `crow-ui`.
# Architecture & Module Boundaries (https://crow.build/docs/guides/architecture)
Crow is engineered from day one as an **Android-native, layered, strictly bounded architecture** verified on every CI run by Gradle invariant checks.
## Three Enforced Architectural Guarantees [#three-enforced-architectural-guarantees]
1. **`checkCorePurity` — Pure-JVM, Android-Free Core**
Eleven core modules (`crow-signals`, `crow-runtime`, `crow-router`, `crow-image`, `crow-query`, `crow-store`, `crow-state`, `crow-color`, `crow-schema`, `crow-motion`, `crow-inject`) are verified to contain **zero** `android.*` or `androidx.*` imports. Everything from reactive state and async transitions to lazy list layout, routing, caching, persistence, validation, and perceptual color runs and tests in milliseconds on a plain JVM.
2. **`checkCoreIndependence` — Design Systems Are Optional**
Core modules never import or depend on `crow-material3`, `crow-lens`, or `crow-symbols`. Core APIs use neutral concepts (*overlay* instead of *state layer*, *unstyled bases* instead of Material buttons), so you can ship Material 3, Lens Liquid Glass, or your own brand system on equal footing.
3. **`checkDesignSystemHygiene` — Zero Internal Shortcuts**
Design systems (`crow-material3`, `crow-lens`, `crow-guide`) may only consume Crow core's public API — no reaching into `UiNodeScope`, `currentUiScope()`, or unchecked compiler casts. If a design system hits a limit, core gets a clean public primitive.
## Layered Stack Overview [#layered-stack-overview]
```text
┌──────────────────────────────────────────────────────────────────────┐
│ Optional Design Systems & Icons: crow-material3 · crow-lens · crow-symbols │
├──────────────────────────────────────────────────────────────────────┤
│ Android Renderer & UI: crow-ui · crow-guide · crow-media │
│ Testing & Dev Live: crow-ui-test · crow-live-android │
├──────────────────────────────────────────────────────────────────────┤
│ Pure-JVM App Stack: crow-router · crow-query · crow-store │
│ crow-state · crow-schema · crow-color │
│ crow-motion · crow-image · crow-inject │
├──────────────────────────────────────────────────────────────────────┤
│ Core, K2 & Build Tools: crow-signals · crow-runtime · crow-compiler│
│ crow-build · crow-live · crow-cli-rs │
└──────────────────────────────────────────────────────────────────────┘
```
## Android-Native by Design [#android-native-by-design]
- **Direct Android Rendering:** `crow-ui` compiles straight to Android `RenderNode` / HWUI + AGSL shaders + native `AccessibilityNodeProvider` + zero-AndroidX `@CrowApp` — no cross-platform abstraction tax.
- **Zero-Gradle App Builds & Hot Reload:** `crow-build` (`crow.jsonc` / `crow.lock`) and the native Rust `crow` CLI (`crow-cli-rs`) drive a persistent `crow-daemon` for zero-AGP APK packaging and ~30 ms on-device delta-DEX hot reload via `crow-live` + `crow-live-android`.
- **Public ABI stability:** Every published library module maintains committed Kotlin ABI dumps verified by `gradle checkApi`, paired with `crow-bom` for aligned releases.
# Benchmarks & Methodology (https://crow.build/docs/guides/benchmarks)
Every performance claim Crow makes is backed by real hardware measurements, committed raw `.jsonl` traces in `docs/benchmarks/`, and reproducible scripts. No hand-picked microbenchmarks, no debug builds.
## Hardware & Build Conditions [#hardware--build-conditions]
- **Device**: Xiaomi 2201116SG (Qualcomm Snapdragon 695: 2 × Cortex-A78 + 6 × Cortex-A55, 1080 × 2400 @ 440 dpi, **120 Hz**, Android 13)
- **Builds**: R8 full-mode release builds, AOT-compiled identically with `cmd package compile -m speed -f` (except E2 fresh-install TTID, measured under both `verify` and `speed-profile`)
- **Compose baseline**: Compose BOM `2026.11.01` (UI `1.13.0`), measured on both default gap-buffer and link-table composers
---
## 1. E1 — 1,000-Row Feed (Creation, Updates & Heap) [#1-e1--1000-row-feed-creation-updates--heap]
1,000 interactive rows (avatar circle, title, live `"N likes"` counter, clickable like dot with live color) mounted synchronously in a vertical scroll. Medians of 3 runs (25 creation iterations / 40 update rounds per run).
| Metric (Snapdragon 695, medians) | Crow (compiled) | Compose (gap) | Compose (link table) | Crow vs Best Compose |
| --- | --- | --- | --- | --- |
| **Create 1,000 rows** | **76.5 ms** | 489.8 ms | 501.2 ms | **0.16×** (6.4× faster) |
| **GC pauses during mount** | **0 / 25** | 25 / 25 | 25 / 25 | **Zero GC** |
| **Java heap retained** | **1.31 MB** | 20.65 MB | 20.65 MB | **0.06×** (15.8× less) |
| **Native heap retained** | **0.68 MB** | 1.89 MB | 1.89 MB | **0.36×** (2.8× less) |
| **Update 1 of 1,000 rows** | **3.0 ms** | 89.3 ms | 95.1 ms | **0.03×** (29.8× faster) |
| **Update every 10th row (100 rows)** | **25.6 ms** | 101.3 ms | 99.9 ms | **0.26×** (3.9× faster) |
Thanks to `LocalGraph` lowering, modifier fusion, and binding fusion, Crow's **compiled** declarative screen retains **1,309 KB** Java heap vs **1,317 KB** for the hand-written imperative Crow UI baseline (−2.6 KB in class-histogram heap dumps) and matches its update latency within noise.
---
## 2. Pokédex — Full App vs Views & Compose (120 Hz) [#2-pokédex--full-app-vs-views--compose-120-hz]
Google's Compose performance page benchmarks `skydoves/Pokedex` (Views) vs `skydoves/pokedex-compose` (Compose). We rebuilt `pokedex-compose` screen for screen in Crow (`benchmarks/pokedex-crow`, ~650 lines: `LazyVerticalGrid`, `crow-query`, `crow-image`, `crow-material3`, shared-element flights, live theme switching) and measured all three back to back in one session (10 cold starts, 5 scroll runs of ~1,030 frames each, zero thermal throttling).
| Metric (Snapdragon 695, 120 Hz) | Views (from source) | Compose | **Crow** | Crow / Compose |
| --- | --- | --- | --- | --- |
| **Cold start (TTID)** | 507.5 ms | 462.5 ms | **394 ms** | **0.85×** |
| **Janky frames (per-run median)** | 0.39% | 0.88% | **0.39%** | **0.44×** |
| **Janky frames (all 5 runs, ~5.1k frames)** | 0.41% (21) | 2.50% (128)¹ | **0.37% (19)** | — |
| **Frame time p50** | 9 ms | 14 ms | **11 ms** | **0.79×** |
| **Frame time p90** | 14 ms | 18 ms | **15 ms** | **0.83×** |
| **Frame time p99** | 17 ms | 29 ms | **23 ms** | **0.79×** |
| **Memory after scrolling (PSS)** | 133.0 MB | 175.1 MB | **156.9 MB** | **0.90×** |
*¹ Compose run 2 experienced a whole-run spike (98 of 128 janky frames); quote per-run median jank (**0.39% vs 0.88%**) rather than the outlier-skewed sum. Even excluding that run, Compose averaged 0.73% vs Crow's 0.37% and Views' 0.41%.*
---
## 3. E2 — Generated DEX Code Size & Cold Start [#3-e2--generated-dex-code-size--cold-start]
A synthetic 150-component, 30-screen Material-shaped catalog generated identically for Crow and Compose, compiled with R8 full mode (`-dontobfuscate` for exact app-code attribution):
| Dynamic Argument Share | Crow App DEX | Compose App DEX | Size Ratio |
| --- | --- | --- | --- |
| **10% dynamic** | **190 KB** (572 methods) | 301 KB (505 methods) | **0.63×** |
| **35% dynamic** | **270 KB** (570 methods) | 340 KB (493 methods) | **0.79×** |
| **60% dynamic** | **318 KB** (571 methods) | 357 KB (455 methods) | **0.89×** |
### E2 Cold Start (21 interleaved launches on Snapdragon 695) [#e2-cold-start-21-interleaved-launches-on-snapdragon-695]
- **`verify` (fresh install, no profiles)**: Crow **387 ms** vs Compose **488 ms** (**0.79×**)
- **`speed-profile`**: Crow **364 ms** vs Compose **464 ms** (**0.78×**) — even though Compose ships baseline profiles and Crow does not yet
- **Whole APK size**: Crow **149 KB** vs Compose **1,035 KB**
## Honest Caveats [#honest-caveats]
- All real-device runs so far are on a single Snapdragon 695 phone; additional gate devices (Pixel 6a and an Android Go phone) are planned.
- Both Pokédex builds were AOT-compiled (`-m speed`), so baseline profiles played no role in the Pokédex cold-start table.
- Pokédex benchmarks measure home-screen cold start and vertical grid flinging; details-screen stat animations are not yet implemented in the Crow port.
- Raw `.jsonl` files and scripts live in `docs/benchmarks/` and `benchmarks/` so anyone can re-run and verify:
```bash
gradle :benchmarks:pokedex-crow:assembleRelease
ANDROID_SERIAL= benchmarks/pokedex/compare.sh /tmp/pokedex-run 10 5
```
# Headless UI Testing (crow-ui-test) (https://crow.build/docs/guides/testing)
`crow-ui-test` runs your **real** Crow UI tree and `CrowView` headlessly on the JVM via Robolectric — giving you millisecond feedback loops, deterministic frame stepping, gesture replay, semantics assertions, and pixel-accurate PNG snapshots with zero emulator flakiness.
## Writing a Headless UI Test [#writing-a-headless-ui-test]
```kotlin title="CounterScreenTest.kt"
@RunWith(RobolectricTestRunner::class)
class CounterScreenTest {
@Test
fun tappingAddIncrementsCountAndUpdatesSemantics() {
headless {
MaterialTheme { CounterScreen() }
}.use { app ->
// Advance deterministically until initial layout & animations settle
app.settle()
assertTrue(app.dump().contains("Count: 0"))
// Tap by text or semantics label
app.tap("Add 1")
app.frame()
assertTrue(app.dump().contains("Count: 1"))
assertTrue(app.dump().contains("Next tap reaches 2"))
}
}
}
```
## Capabilities [#capabilities]
- **Deterministic motion clock**: Call `app.frame()` to step a single frame (16 ms default) or `app.settle()` to advance analytic springs, exit ghosts, and pending transitions cleanly without `Thread.sleep`.
- **Scripted input**: Replay `tap`, `drag`, `fling`, `type`, `imeAction`, hardware `key`, `resize`, and `back` against real hit-testing and gesture recognizers.
- **Semantics & layout tree dumps**: `app.dump()` prints node kinds, bounds, text content, and TalkBack semantics roles/states for crisp structural assertions.
- **Real PNG snapshots**: Call `app.png(File(...))` to render any screen or overlay state to a PNG with real Skia/Minikin text shaping — ideal for visual diffs, CI artifacts, and AI-assisted UI verification.
- **Headless CLI rendering**: Render any demo screen straight to PNG and a tree dump with:
```bash
gradle :benchmarks:e1:headlessRender -Pscreen=gallery
```
## Testing Reactive Core & Queries on Pure JVM [#testing-reactive-core--queries-on-pure-jvm]
Because `crow-signals`, `crow-runtime`, `crow-router`, `crow-image`, `crow-query`, `crow-store`, `crow-state`, `crow-schema`, `crow-color`, `crow-motion`, and `crow-inject` are **100% pure JVM** (`checkCorePurity`), unit tests for business logic, state graphs, forms, persistence, and caching run on plain JVM with zero Android runtime overhead.
# Introduction (https://crow.build/docs)
**Crow** is an unapologetically **Android-native**, fine-grained reactive UI framework and full-stack Kotlin platform built for the AI era. It keeps declarative ergonomics — `@Ui` functions, `Column { }`, `Modifier` chains, composable interaction behaviors — and replaces recomposition underneath with a **SolidJS-style signals graph** that the **Kotlin K2 compiler** mostly compiles away.
Components execute **once** at mount. When state changes, no UI function ever re-runs: the signal notifies the exact render-node property (`TextNode.text`, `RenderNode.alpha`, background color, layout constraint) that depends on it.
> **As the crow flies** — a straight line from signal to pixel, with no recomposition in between.
Crow targets Android natively (`RenderNode` / HWUI, AGSL Liquid Glass, native `AccessibilityNodeProvider`, zero-AndroidX `@CrowApp`, and a zero-Gradle `crow-build` APK pipeline) with 11 pure-JVM core modules for instant host unit tests. Public Maven Central artifacts are coming soon.
## Why Crow? [#why-crow]
Traditional retained-mode declarative UI engines re-execute component functions on state change and rely on runtime diffing, slot tables, stability annotations, and skipping heuristics to claw back performance.
Crow solves the problem at its root:
- **Zero recomposition by construction** — `@Ui` functions run once to construct your render tree and wire direct bindings. Updating 1 row in a 1,000-row list touches 1 node (**3.0 ms vs 89.3 ms** in Jetpack Compose on a Snapdragon 695 phone).
- **Compiled away by K2** — `crow-compiler` lowers local `signal()` declarations into a single `LocalGraph` class per component, fuses built-in modifier chains into direct node writes, fuses once-per-instance bindings, and checks for stale reads (`CR1001`), build-time writes (`CR1002`), and stored `@Ui` lambdas (`CR1003`) at compile time.
- **No ViewModel or AndroidX ceremony** — Process-death restoration (`var query by saved("")`), held async transitions (`Loading` / `Errored` / `resource`), and process-scoped state (`@CrowApp(process = AppStore::class)`) are built into the reactive core.
- **Building blocks first, design systems on top** — Composable building blocks, physics-driven motion, gestures, zero-wiring AGSL Liquid Glass, and `crow-style` come first. `crow-material3` and `crow-lens` sit strictly on top — and you or your AI agent can build a completely custom design system on the exact same foundation.
- **A complete, zero-glue stack** — File-based routing, TanStack-inspired `crow-query`, crash-safe `crow-store`, Zod-style `crow-schema`, perceptual `crow-color`, analytic `crow-motion`, `crow-media`, `crow-symbols`, `crow-guide`, `crow-build` (`crow.jsonc` zero-AGP APK builds), and delta-DEX Android hot reload.
## Measured on Real Hardware [#measured-on-real-hardware]
All benchmark claims come from R8-optimized, AOT-compiled (`cmd package compile -m speed -f`) release builds measured on a **Snapdragon 695 phone** (Xiaomi 2201116SG, Android 13, 120 Hz):
| Benchmark | Crow | Jetpack Compose | Ratio |
| --- | --- | --- | --- |
| **E1** · Create 1,000-row feed | **76.5 ms** | 489.8 ms | **0.16×** (6.4× faster) |
| **E1** · Update 1 of 1,000 rows | **3.0 ms** | 89.3 ms | **0.03×** (29.8× faster) |
| **E1** · Retained Java heap | **1.31 MB** | 20.65 MB | **0.06×** (15.8× less) |
| **E1** · GC pauses during mount | **0 / 25** | 25 / 25 | **Zero GC** |
| **Pokédex** · Cold start (TTID) | **394 ms** | 462.5 ms | **0.85×** |
| **Pokédex** · Median scroll jank (120 Hz) | **0.39%** | 0.88% | **0.44×** (matches Views) |
| **E2** · App DEX size (35% dynamic) | **270 KB** | 340 KB | **0.79×** |
See [Benchmarks & Methodology](/docs/guides/benchmarks) for full tables, caveats, and reproduction commands.
## Explore the Documentation [#explore-the-documentation]
# Installation (https://crow.build/docs/installation)
Crow is structured as a modular set of Kotlin libraries powered by the **`crow-compiler`** K2 plugin, the zero-Gradle **`crow-build`** engine (`crow.jsonc` + `crow` CLI), and Gradle plugins (`crow.app` and `crow.routes`).
## Requirements [#requirements]
- **Kotlin**: `2.4.21` (K2 compiler)
- **JDK**: `17` toolchain (`21` for AGP runtime)
- **Android**: `minSdk = 26` (`compileSdk = 36`)
- **Gradle**: `9.9+` (when building with Gradle)
## Option A: Declarative `crow.jsonc` (Zero-Gradle) [#option-a-declarative-crowjsonc-zero-gradle]
Scaffold a new Android-native Crow app with the `crow` CLI:
```bash
crow new my-app --design-system lens --routes --inject
cd my-app
crow dev
```
Your project manifest lives in `crow.jsonc` with full JSON Schema validation and deterministic `crow.lock` dependency locking.
## Option B: Gradle Setup [#option-b-gradle-setup]
### Apply Crow Gradle plugins [#apply-crow-gradle-plugins]
For a standalone Android app, apply `crow.app` (which generates your zero-AndroidX `Activity` and `Application` from `@CrowApp`) and optionally `crow.routes` for file-based routing.
```kotlin title="app/build.gradle.kts"
plugins {
alias(libs.plugins.android.application)
id("crow.app")
id("crow.routes") // Optional: file-based routing
}
```
### Register the K2 compiler plugin [#register-the-k2-compiler-plugin]
Wire `crow-compiler` into Kotlin's compiler plugin classpath so `@Ui` functions, live props, `LocalGraph` lowering, modifier fusion, zero-key `saved()`, and `CR1001`/`CR1002`/`CR1003` checks run automatically:
```kotlin title="app/build.gradle.kts"
configurations
.matching { it.name.startsWith("kotlinCompilerPluginClasspath") }
.configureEach {
dependencies.add(project.dependencies.project(":crow-compiler"))
}
```
### Add dependencies [#add-dependencies]
Pick only the modules you need. Every core library stays strictly independent of design systems (`crow-material3` and `crow-lens` are optional design systems).
```kotlin title="app/build.gradle.kts"
dependencies {
implementation(project(":crow-ui"))
implementation(project(":crow-router"))
implementation(project(":crow-query"))
implementation(project(":crow-store"))
implementation(project(":crow-schema"))
implementation(project(":crow-color"))
implementation(project(":crow-motion"))
implementation(project(":crow-lens"))
implementation(project(":crow-symbols"))
implementation(project(":crow-guide"))
testImplementation(project(":crow-ui-test"))
testImplementation(kotlin("test-junit"))
}
```
```kotlin title="app/build.gradle.kts"
dependencies {
implementation(project(":crow-ui"))
implementation(project(":crow-material3"))
implementation(project(":crow-query"))
implementation(project(":crow-motion"))
implementation(project(":crow-symbols"))
testImplementation(project(":crow-ui-test"))
testImplementation(kotlin("test-junit"))
}
```
```kotlin title="app/build.gradle.kts"
dependencies {
implementation(project(":crow-ui"))
implementation(project(":crow-color"))
implementation(project(":crow-motion"))
implementation(project(":crow-symbols"))
testImplementation(project(":crow-ui-test"))
testImplementation(kotlin("test-junit"))
}
```
## Module Map [#module-map]
Crow separates **pure-JVM core modules** (verified Android-free by `gradle checkCorePurity`) from Android UI rendering, devtools, and optional design systems (verified by `gradle checkCoreIndependence`):
| Module | Layer | Target | Purpose |
| --- | --- | --- | --- |
| `crow-signals` | Core | JVM | Reactive graph: `signal`, `derived`, `effect`, `resource`, transitions, `action` |
| `crow-runtime` | Core | JVM | `@Ui`, `@Once`, `@Props`, `For`, `Loading`, `Errored`, `BackStack`, `NavHost`, `saved()` |
| `crow-compiler` | Compiler | K2 Plugin | K2 FIR checks (`CR1001`–`CR1003`, `CR2001`–`CR2007`), `$ui` lowering, `LocalGraph`, modifier & binding fusion |
| `crow-ui` | Renderer | Android | `LNode` tree, `RenderNode` chunks, layout, gestures, `crow.ui`, `crow.style`, AGSL glass engine |
| `crow-router` | Stack | JVM | Typed navigation & `crow.routes` file-based routing runtime |
| `crow-query` | Stack | JVM | Typed server-state cache (`query`, `infiniteQuery`, `QueryClient`, optimistic mutations) |
| `crow-store` | Stack | JVM | Reactive key/document store, codecs, migrations, crash-safe `FileStoreBackend` |
| `crow-state` | Stack | JVM | Structured app state containers and unidirectional state primitives |
| `crow-schema` | Stack | JVM | Zod-style validation DSL, `FormState`, cross-field rules, JSON Schema export |
| `crow-color` | Stack | JVM | Perceptual OKLab/OKLCH, WCAG/APCA contrast solver, palettes, artwork extraction |
| `crow-motion` | Stack | JVM | Analytic springs, `Animatable`, `animateFloat`, velocity-preserving retargeting |
| `crow-image` | Stack | JVM | Byte-budgeted LRU `ImageEngine`, cover-size hardware bitmaps, `imageResource` |
| `crow-inject` | Stack | JVM | Scoped lifetime dependency graphs with `Async` bindings and test overrides |
| `crow-guide` | Stack | Android | TipKit-style contextual tips and morphing spotlight tours across routes |
| `crow-media` | Stack | Android | Native Android media playback, gestures, and surface primitives |
| `crow-material3` | Design system | Android | Optional Material 3 components, live `ColorScheme`, dynamic wallpaper color |
| `crow-lens` | Design system | Android | Optional shadcn × Liquid Glass design system |
| `crow-symbols` | Icons | Android | 3,893 Material Symbols (Rounded/Outlined/Sharp + `SymbolStyle.Soft`) + variable axes + subsetter |
| `crow-codegen` | Tooling | JVM | Shared Android code generators for `@CrowApp` and `crow.routes` |
| `crow-build` | Tooling | JVM | Declarative `crow.jsonc` / `crow.lock`, zero-AGP Android APK pipeline, persistent `crow-daemon`, and project scaffolder |
| `crow-cli` | Tooling | Rust | Thin native `< 5 ms` `crow` CLI binary driving `crow-daemon` |
| `crow-live` | Tooling | JVM | Warm K2 compiler, delta-DEX Android hot-reload pusher, `LiveProtocol` v2 |
| `crow-live-android` | Tooling | Android | Debug-only on-device `CrowDevAgent` receiver, tree & signal-graph inspectors |
| `crow-ui-test` | Testing | Android/JVM | Headless Robolectric test harness: frames, gestures, semantics dumps, PNG snapshots |
| `crow-bom` | BOM | JVM | Bill of Materials aligning versions across all Crow library modules |
## Verify Your Workspace [#verify-your-workspace]
If you are working inside the Crow repository, run the core test suite and boundary checks with:
```bash
gradle :crow-signals:test :crow-runtime:test :crow-compiler:test \
:crow-ui:testReleaseUnitTest :crow-ui-test:testReleaseUnitTest \
checkCorePurity checkCoreIndependence checkDesignSystemHygiene
```
# Quickstart (https://crow.build/docs/quickstart)
With `crow.app` and `@CrowApp`, you do not need to write a `MainActivity`, an `Application` subclass, or `` XML in `AndroidManifest.xml`. Your `@Ui` function is the entire entry point.
## Your First Crow App [#your-first-crow-app]
```kotlin title="src/main/kotlin/com/example/counter/App.kt"
package com.example.counter
import crow.material3.Button
import crow.material3.FilledTonalButton
import crow.material3.MaterialTheme
import crow.material3.Surface
import crow.runtime.CrowApp
import crow.runtime.Ui
import crow.runtime.saved
import crow.signals.getValue
import crow.signals.setValue
import crow.signals.signal
import crow.ui.Alignment
import crow.ui.Arrangement
import crow.ui.Column
import crow.ui.Modifier
import crow.ui.Row
import crow.ui.Text
import crow.ui.dp
import crow.ui.fillMaxSize
import crow.ui.padding
import crow.ui.safeDrawingPadding
@CrowApp(label = "Counter")
@Ui
fun CounterApp() {
MaterialTheme {
Surface(Modifier.fillMaxSize()) {
CounterScreen()
}
}
}
@Ui
fun CounterScreen() {
// Process-death surviving state — the K2 compiler assigns a stable key automatically.
var count by saved(0)
// Pure in-memory fine-grained signal — compiled into a LocalGraph field.
var step by signal(1)
// Memoized derived value — recomputes only when `count` or `step` changes.
val nextValue by { count + step }
Column(
modifier = Modifier
.fillMaxSize()
.safeDrawingPadding()
.padding(24.dp),
verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text("Count: $count", style = MaterialTheme.typography.displaySmall)
Text("Next tap reaches $nextValue", style = MaterialTheme.typography.bodyLarge)
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
Button(onClick = { count += step }) {
Text("Add $step")
}
FilledTonalButton(onClick = { step = if (step == 1) 5 else 1 }) {
Text("Step: $step")
}
}
}
}
```
## What Happens When You Tap "Add"? [#what-happens-when-you-tap-add]
Trace the exact execution path when `count += step` runs:
### `CounterScreen()` does NOT re-run [#counterscreen-does-not-re-run]
Unlike recomposition-based frameworks, `CounterScreen` ran **once** when mounted. Its `Column`, `Row`, `Button`, and `FilledTonalButton` are never revisited.
### The K2-compiled `LocalGraph` fires directly [#the-k2-compiled-localgraph-fires-directly]
`count` writes to its generated field, `nextValue` marks dirty lazily, and the batched flush writes the two new strings directly into the two `TextNode`s.
### Only the two text nodes re-record [#only-the-two-text-nodes-re-record]
Crow UI's incremental layout re-measures only the dirty `TextNode`s. If their widths don't change, nothing else even moves.
## Hosting Manually in an Existing Activity [#hosting-manually-in-an-existing-activity]
If you prefer an explicit `Activity` (or are embedding Crow into an existing app), host any `@Ui` tree inside `CrowView`:
```kotlin title="MainActivity.kt"
class MainActivity : Activity() {
private lateinit var host: CrowView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AndroidScheduler.install()
host = CrowView(this)
setContentView(host)
host.setContent { CounterApp() }
}
}
```
## Next Steps [#next-steps]
# Perceptual Color & Palettes (crow-color) (https://crow.build/docs/stack/color)
`crow-color` is a platform-free perceptual color library engineered for accessible UI systems, smooth animations, and dynamic theming across any design system (not just Material).
## Perceptual Spaces (`OKLab` & `OKLCH`) [#perceptual-spaces-oklab--oklch]
Standard sRGB interpolation muddies gradients through gray. `crow-color` converts ARGB colors into perceptual `OklabColor` and `OklchColor` for uniform lightness and vivid chroma:
```kotlin
val violet = 0xFF7C5CFF.toInt()
val cyan = 0xFF22D3EE.toInt()
val oklch = violet.toOklch()
val midpoint = blendOklab(violet, cyan, 0.5f)
val vibrantMidpoint = blendOklch(violet, cyan, 0.5f)
```
## Contrast Solvers (WCAG & APCA) [#contrast-solvers-wcag--apca]
Guarantee legible text on dynamic, user-chosen, or artwork-extracted surfaces at runtime:
```kotlin
val ratio = ColorContrast.wcagRatio(foreground, background)
val apca = ColorContrast.apcaContrast(foreground, background)
// Automatically pick white or dark ink for maximum legibility
val ink = ColorContrast.bestOnColor(background)
// Nudge foreground lightness in OKLCH until it satisfies WCAG AA (4.5:1)
val safeAccent = ColorContrast.ensureContrast(
foreground = accent,
background = surface,
minRatio = ColorContrast.WCAG_AA,
)
```
## Harmonies, Ramps & Artwork Swatches [#harmonies-ramps--artwork-swatches]
- **`ColorHarmonies`**: Compute `complementary`, `analogous`, `triadic`, `splitComplementary`, and `tetradic` palettes directly in OKLCH hue space.
- **`ColorRamp`**: Sample smooth, perceptually spaced color stops (`ramp.sample(t)`).
- **`ColorSwatch`**: Extract dominant and vibrant swatches from cover artwork, pre-paired with contrast-verified `onTextArgb` and `onSubtitleArgb` foreground colors so detail screens adapt to album art or photography with zero contrast bugs.
# Tips & Interactive Tours (crow-guide) (https://crow.build/docs/stack/guide)
`crow-guide` brings Apple TipKit-style contextual education and multi-step interactive onboarding tours directly into Crow's overlay and routing layers — with **zero `PopupWindow` hacks**.
## Contextual Tips with Rules [#contextual-tips-with-rules]
Define tips declaratively with priority and display rules (`maxDisplays`, event counts, custom predicates):
```kotlin
object AppTips {
val FilterHint = Tip(
id = "brews.filter.hint",
priority = 10,
rules = tipRules { maxDisplays(3) },
)
}
```
Manage tip state with `TipCenter` (backed by `FileTipStore` or `InMemoryTipStore`) and provide it via `LocalTipCenter(tipCenter) { ... }`.
## Multi-Step Tours Across Typed Routes [#multi-step-tours-across-typed-routes]
Declare a `tour` where each step specifies a target ID, spotlight cutout shape (`RoundedRect`, `Circle`), popover placement, and the typed `crow-router` route it lives on:
```kotlin
val introTour = tour("app.intro") {
step(
id = "filter-bar",
title = "Filter Conversations",
body = "Switch between All, Pinned, and Unread threads instantaneously.",
shape = SpotlightShape.RoundedRect,
side = PopupSide.Below,
route = Routes.Feed,
)
step(
id = "composer-bar",
title = "Quick Composer",
body = "Draft replies with live attachments and instant optimistic delivery.",
shape = SpotlightShape.RoundedRect,
side = PopupSide.Below,
route = Routes.Compose,
)
}
```
Tag any UI node anywhere in your app with `Modifier.tourTarget(controller, "filter-bar")`:
- **Morphing `SpotlightScrim`**: As the user taps *Next*, the spotlight cutout smoothly morphs its position and corner radius from the previous target to the next.
- **Cross-route navigation**: When the next step lives on another tab or screen, `TourController` navigates there automatically via `crow-router` and scrolls off-screen targets into view.
- **Anchored glass balloons**: `BalloonBase` keeps its arrow pointing accurately at the target even when shifted near screen edges or while scrolling.
- **Headless testable**: Drive and verify every tour step deterministically in `crow-ui-test`.
# Dependency Injection (crow-inject) (https://crow.build/docs/stack/inject)
`crow-inject` is Crow's compile-time, owner-scoped dependency injection library built directly into the K2 Crow compiler plugin (`CR2001`–`CR2007`, zero KSP/kapt).
## Core Concepts [#core-concepts]
- **Scopes match lifetimes**: `@AppGraph` graphs live for the OS process; screen graphs live for their `BackStack` entry under `InjectedNavHost`; `@KeyedScope` boundaries (`ScopeHost(Session::class)`) automatically unmount UI and dispose in strict reverse dependency order when `@ScopeKey` changes.
- **No scope leaks**: Compile-time `CR2004` checks prevent longer-lived scopes from depending on shorter-lived or missing keyed scopes.
- **`Async` dependencies**: Provide asynchronous services (`async { ... }`) as graph-owned resources that suspend cleanly under a `Loading` boundary or `.await()` off-UI.
- **Lazy & Provider**: Defer instantiation or break intentional cycles with `Lazy` or `() -> T`.
## Providing & Injecting Screens [#providing--injecting-screens]
```kotlin
@ContributesBinding(App::class)
@Inject
class RealTvShowApi : TvShowApi { /* ... */ }
@Inject
@Scoped(Screen::class)
class ShowDetailsModel(
val route: ShowDetailsRoute,
val api: TvShowApi,
) : StateHolder() {
var bookmarked by saved(false)
}
@Inject
@Ui
fun ShowDetailsScreen(@Once route: ShowDetailsRoute, @Once model: ShowDetailsModel) {
// Parameters are resolved directly from the generated screen graph
}
@AppGraph
interface AppRoot {
val api: TvShowApi
}
// Wire at the app root:
val graph = createGraph()
InjectHost(graph) {
InjectedNavHost(backStack)
}
```
## Two-Line Test & Preview Overrides [#two-line-test--preview-overrides]
Swap real network clients or stores for type-checked fakes in any headless test or preview without touching production wiring:
```kotlin
val testGraph = createGraph {
replace(FakeTvShowApi())
replace(InMemoryWatchlistRepo())
}
```
For scoped subtree overrides in previews (unscoped or strictly deeper-scoped bindings), wrap the subtree in `Overrides({ replace("Preview") }) { ... }`.
Disposal order and scope lifetimes are verified by multi-seed property tests across compiled random DAGs and randomized navigation + keyed-scope transitions, ensuring dependents always close before their dependencies and UI always unmounts before holders clear.
# Server Data (crow-query) (https://crow.build/docs/stack/query)
`crow-query` is Crow's platform-free server-state manager. Stateless `query` and `infiniteQuery` descriptors define how to fetch data; a context-provided `QueryClient` manages caching, request deduplication, refcounting, per-entry epochs, prefetching, and foreground revalidation.
## Declaring Queries [#declaring-queries]
Define descriptors once at the top level — zero coupling to any screen or ViewModel:
```kotlin
val PokemonPages = infiniteQuery(
initialCursor = { _: Unit -> 0 },
nextCursor = { page, pages -> if (page.size < 20) null else pages.size },
policy = QueryPolicy(staleTime = 5.minutes),
) { _, page ->
PokeApi.fetchPage(page)
}
val PokemonDetails = query(
policy = QueryPolicy(staleTime = 10.minutes),
) { name: String ->
PokeApi.fetchDetails(name)
}
```
## Observing & Prefetching in UI [#observing--prefetching-in-ui]
Provide a `QueryClient` at your app root with `LocalQueryClient(client) { ... }`, then observe queries directly inside `@Ui` functions:
```kotlin
@Ui
fun PokemonDetailsScreen(name: String) {
val details = PokemonDetails { name }
Errored(fallback = { err, retry ->
ErrorView(err.message, onRetry = { details.reload(); retry() })
}) {
Loading(fallback = { DetailsSkeleton() }) {
DetailsContent(details.value, refreshing = details.isFetching)
}
}
}
```
Prefetch on tap (or hover/scroll) so the detail screen opens instantly from cache:
```kotlin
val client = LocalQueryClient.current
PokemonCard(
pokemon = item,
onClick = {
PokemonDetails.prefetch(item.name, client)
router.navigate(Routes.Details(item.name))
},
)
```
## Why `crow-query` Beats Bolted-On Caches [#why-crow-query-beats-bolted-on-caches]
- **Non-holding background revalidation**: Stale cached data displays immediately and refreshes silently in the background **without holding** a UI transition. Cold cache misses wait cleanly under `Loading`.
- **Epoch-protected mutations**: Running a mutation inside `action { ... }` with `PokemonDetails.optimistic(name, client) { ... }` and `PokemonDetails.invalidate(name, client).await()` increments the entry epoch, cancelling stale in-flight fetches so an older network response can never overwrite a newer mutation (verified by a 500-seed interleaving fuzzer).
- **Lifecycle wiring**: Hook `client.onForeground()` and `client.trim()` into your host (`ProcessHost.isForeground` / `onTrimMemory`) to automatically refresh stale active queries and release unused cache entries under memory pressure.
# File-Based & Typed Routing (https://crow.build/docs/stack/routing)
`crow-router` (paired with the `crow.routes` Gradle plugin) turns your `routes/` folder into a compile-time, type-safe navigation graph — inspired by Expo Router and Next.js App Router, built natively for Kotlin and Android.
## Folder Conventions [#folder-conventions]
Every Kotlin file under your `routes/` directory becomes a strongly typed route on the generated `Routes` object:
| File / Folder | Generated Route | Behavior |
| --- | --- | --- |
| `brews.kt` | `Routes.Brews` | Standard page |
| `brew/_id.kt` | `Routes.Brew.Id(id)` | Dynamic path parameter (`_id` = path identity) |
| `files/__path.kt` | `Routes.Files.Path(path)` | Catch-all wildcard segment |
| `_group_main/_layout.kt` | Tab shell (`@TabsLayout`) | Independent back stack & scroll state per tab |
| `log_brew.kt` | `Routes.LogBrew(method, dose)` | Optional function params become live query params |
| `_not_found.kt` | Fallback route | Unmatched deep links |
## Declaring Pages & Sheets [#declaring-pages--sheets]
A page's parameters are simply its `@Page @Ui` function parameters. Path parameters define entry identity; query parameters arrive as **live props** updated in place without remounting the screen:
```kotlin title="routes/log_brew.kt"
val logBrewConfig = routeConfig {
presentation = Presentation.Sheet
}
@Page
@Ui
fun LogBrewScreen(
method: BrewMethod = BrewMethod.PourOver,
dose: Int = 15,
water: Int = 240,
) {
val router = router()
// ...
Button(onClick = { router.dismiss() }) { Text("Done") }
}
```
Navigate from anywhere with full compile-time type safety:
```kotlin
val router = router()
router.navigate(Routes.Brew.Id(id = brew.id))
router.navigate(Routes.LogBrew(method = BrewMethod.Espresso, dose = 18))
```
## Tab Shells with Independent Histories [#tab-shells-with-independent-histories]
Annotate a group layout with `@TabsLayout` and render `SelectedTab(tabs)`:
```kotlin title="routes/_group_main/_layout.kt"
@TabsLayout("brews", "beans", "studio")
@Ui
fun MainTabs(@Once tabs: TabsScope) {
Box(Modifier.fillMaxSize()) {
SelectedTab(tabs)
TabBar(
items = tabItems,
selected = tabs.selected,
onSelect = tabs::select,
)
}
}
```
Switching tabs keeps covered tabs **dormant** (no layout, draw, or effects) while preserving their scroll position and sub-stack.
## Low-Level `BackStack` & `NavHost` [#low-level-backstack--navhost]
If you prefer programmatic routing without file generation, `crow-runtime` provides `BackStack` and `NavHost(stack)` directly — complete with `keepAlive` dormant screens, `ModalRoute`, typed `pushForResult`, held data transitions (up to 150 ms so destination screens never flash empty), route transitions, shared elements, and 1:1 predictive back.
# Schemas & Reactive Forms (crow-schema) (https://crow.build/docs/stack/schema)
`crow-schema` brings a concise, composable **Zod-style validation DSL** directly to Kotlin — paired with a fine-grained `FormState` where every field's value, error, touched, dirty, valid, and async-validating status is a reactive `Signal` / `Read`.
## Building Schemas [#building-schemas]
```kotlin
val emailSchema = Schemas.string()
.trim()
.email("Enter a valid email address")
val doseSchema = Schemas.int()
.min(10, "Minimum dose is 10g")
.max(40, "Maximum dose is 40g")
val titleSchema = Schemas.string()
.trim()
.min(1, "Title is required")
.max(60, "Keep title under 60 characters")
```
Call `schema.safeParse(input)` anywhere (UI, network layer, tests) for typed `ParseResult.Success` / `ParseResult.Failure` with structured error paths — or call `schema.toJsonSchema()` to emit standard JSON Schema definitions.
## Signal-Backed `FormState` [#signal-backed-formstate]
Bind schemas directly to Crow inputs so each field validates independently with zero whole-form recomposition:
```kotlin
@Ui
fun LogBrewForm(@Once onSaved: (String, String) -> Unit) {
val form = FormState(mode = ValidationMode.OnChange)
onCleanup { form.dispose() }
val title = form.field("title", "", titleSchema)
val notes = form.field("notes", "", Schemas.string().trim().max(240))
// Cross-field validation runs reactively alongside individual fields
form.crossField("notes", "Add notes when logging a custom blend") {
!(title.value.value.contains("Blend", ignoreCase = true) && notes.value.value.isBlank())
}
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
OutlinedTextField(
value = title.value,
label = { Text("Brew title") },
isError = title.error.value != null,
supportingText = { Text(title.error.value ?: "") },
)
Button(
onClick = { form.submit { onSaved(title.value.value, notes.value.value) } },
enabled = form.isValid.value && !form.isSubmitting.value,
) {
Text("Save Brew")
}
}
}
```
### Features [#features]
- **Validation modes**: `OnChange`, `OnBlur`, `OnTouched`, or `OnSubmit` per form.
- **Async field validators**: Attach `AsyncFieldValidator` (e.g., username availability checks) with automatic cancellation and `field.validating` status signal.
- **External errors**: Surface server-side validation messages directly onto any field with `field.setExternalError("Already taken")`.
- **Pure JVM**: `crow-schema` has zero Android dependencies (`checkCorePurity` verified).
# Local Reactive Store (crow-store) (https://crow.build/docs/stack/store)
`crow-store` gives your app durable, signal-backed local storage with **zero reflection**, **zero annotation processors**, and **crash-safe atomic persistence**.
## Defining Keys & Codecs [#defining-keys--codecs]
Declare typed keys with `StoreKeys` and reflection-free `StoreCodec`s for structured documents:
```kotlin
object PrefsKeys {
val ThemeMode = StoreKeys.enum("theme_mode", ThemeMode.entries, ThemeMode.System)
val Accent = StoreKeys.enum("accent", AccentOption.entries, AccentOption.Violet)
val CompactDensity = StoreKeys.boolean("compact_density", false)
val BrewCount = StoreKeys.int("brew_count", 0)
}
```
For rich models, implement `StoreCodec` using `StoreCodecs.packFields` / `unpackFields` (length-prefixed, escaping-safe, and reflection-free):
```kotlin
val BeanCodec = object : StoreCodec {
override fun encode(value: CoffeeBean): String = StoreCodecs.packFields(
listOf(value.id.toString(), value.name, value.roaster, value.remainingGrams.toString()),
)
override fun decode(raw: String): CoffeeBean {
val f = StoreCodecs.unpackFields(raw)
return CoffeeBean(
id = f[0].toInt(),
name = f[1],
roaster = f[2],
remainingGrams = f[3].toInt(),
)
}
}
```
## Reading & Writing Reactively [#reading--writing-reactively]
Open a crash-safe file-backed store (writes to a temporary file, calls `fsync`, and performs an atomic move) or an `InMemoryStoreBackend` for tests:
```kotlin
val store = openFileStore(
file = File(filesDir, "app.crowstore"),
schemaVersion = 1,
)
// Every key is a fine-grained Signal — reading it inside @Ui subscribes directly
val themeSignal = store.state(PrefsKeys.ThemeMode)
val beans = store.collection("beans", idOf = { it.id.toString() }, codec = BeanCodec)
// Atomic multi-key transaction
store.transaction {
store.set(PrefsKeys.BrewCount, currentCount + 1)
beans.upsert(updatedBean)
}
```
### Migrations & Testing [#migrations--testing]
- **Versioned migrations**: Pass `migrations = listOf(StoreMigration(fromVersion = 1, toVersion = 2) { ... })` to evolve keys cleanly across app releases.
- **Process-scoped lifetime**: Pair `ReactiveStore` with `@CrowApp(process = AppStore::class)` so your store opens once per OS process and survives Activity recreations effortlessly.
- **Instant JVM tests**: Swap `FileStoreBackend` for `InMemoryStoreBackend` to test every persistence flow deterministically with zero disk I/O.
# Accessibility, Semantics & Focus (https://crow.build/docs/ui/accessibility)
Accessibility in Crow is built directly into `CrowView` via an `AccessibilityNodeProvider` over the `LNode` tree. It allocates **zero** accessibility objects until an assistive service (such as TalkBack or Switch Access) actually queries the tree.
## Automatic Semantics from Unstyled Bases [#automatic-semantics-from-unstyled-bases]
Every unstyled component (`ButtonBase`, `ToggleBase`, `SwitchBase`, `CheckboxBase`, `RadioButtonBase`, `Slider`, tabs, dialogs, sheets) and every `crow-material3` / `crow-lens` control automatically publishes:
- Correct semantic roles (`Button`, `Switch`, `Checkbox`, `RadioButton`, `Slider`, `Tab`)
- Live checked, selected, disabled, and adjustable range states
- Click, long-click, scroll, expand, collapse, dismiss, and text-editing actions
- Compose-style semantic merging for labeled controls
## Custom Semantics (`Modifier.semantics`) [#custom-semantics-modifiersemantics]
Attach reactive labels, headings, state descriptions, live regions, or custom actions to any node:
```kotlin
Box(
Modifier
.clickable { toggleFavorite() }
.semantics {
contentDescription { if (favorite) "Remove from favorites" else "Add to favorites" }
stateDescription { if (favorite) "Saved" else "Not saved" }
liveRegion = LiveRegion.Polite
},
) {
Icon(
symbol = Symbols.Rounded.Favorite,
style = if (favorite) SymbolStyle.Filled else SymbolStyle.Regular,
)
}
```
- **Tracked like `graphicsLayer`**: When `favorite` flips, only the semantic metadata updates and announces appropriately to TalkBack — zero layout or draw pass.
- **Subtree exclusion**: Dormant `NavHost` screens, hidden `Loading` regions, exiting `AnimatedVisibility` ghosts, and inert screens beneath modal overlays are automatically hidden from TalkBack explore-by-touch.
- **`clearAndSetSemantics`**: Replace descendant semantics when a composite card should be read as one coherent announcement.
## Keyboard Navigation & Focus [#keyboard-navigation--focus]
Crow includes a built-in `FocusManager` supporting hardware keyboards, D-pads, and accessibility traversal:
- `Modifier.focusable()` participates in tree-order `Tab` / `Shift+Tab` traversal and tracks `Interaction.FOCUSED` / `Interaction.FOCUS_VISIBLE`.
- `FocusRequester` lets you programmatically move focus (for example, focusing a search input when a sheet opens).
- `Modifier.onKeyEvent { ... }` handles `Enter`, `Space`, `Escape`, and arrow keys directly on the focused node.
- Overlays automatically save focus on open, clear it (dismissing the IME), and restore focus to the trigger control when dismissed.
# Custom Drawing & AGSL Shaders (https://crow.build/docs/ui/drawing-and-shaders)
When standard containers and styles aren't enough, Crow UI exposes an allocation-free `DrawScope` and first-class Android AGSL runtime shaders — powered by the exact same reactive graph as everything else.
## `drawBehind`, `drawWithContent` & `Canvas` [#drawbehind-drawwithcontent--canvas]
Attach custom vector drawing anywhere in a modifier chain, or create a dedicated `Canvas` leaf:
```kotlin
Canvas(Modifier.size(48.dp)) {
drawArc(
color = AccentViolet,
startAngle = -90f,
sweepAngle = progress.value * 360f,
useCenter = false,
style = DrawStyle.Stroke(4.dp.toPx(), cap = StrokeCap.Round),
)
}
```
- **Fine-grained draw tracking**: Inside `drawBehind`, `drawWithContent`, and `Canvas`, Crow UI wraps execution in `reaction()`. Reading a signal or `Animatable` inside the draw block re-records **only that single node's display list** when the value changes — zero layout pass, zero tree traversal.
- **Chain-order accurate**: `Modifier.drawBehind { }` and `Modifier.drawWithContent { drawContent(); ... }` execute at their exact position relative to padding, clip, and border.
## Brushes & Reactive AGSL Shaders [#brushes--reactive-agsl-shaders]
Crow provides a `Brush` hierarchy (`Brush.solid`, `Brush.linearGradient`, `Brush.radialGradient`) plus Android's `ShaderBrush` for custom **AGSL** (`RuntimeShader`) programs with a mandatory graceful fallback for devices below API 33:
```kotlin
// Declaring `uniform float uTime;` in AGSL feeds elapsed seconds from Motion.clock automatically.
val auroraBrush = ShaderBrush(
agsl = AURORA_AGSL_SOURCE,
fallback = Brush.linearGradient(listOf(0xFF5B3DF5.toInt(), 0xFFB07CFF.toInt())),
uniforms = {
float2("uResolution", width, height)
float2("uTouch", touchX.value, touchY.value)
color("uAccent", theme.accent)
},
)
Box(
Modifier
.fillMaxWidth()
.height(220.dp)
.clip(RoundedCornerShape(24.dp))
.background(auroraBrush),
)
```
### Why Crow Shaders Feel Effortless [#why-crow-shaders-feel-effortless]
- **Reactive uniforms**: Reading signals or `Animatable` values inside `uniforms = { ... }` tracks them directly in the draw phase — animating a shader uniform never triggers layout or recomposition.
- **Dormancy-aware `uTime`**: Reading the motion clock automatically pauses when a screen becomes dormant in the back stack or the app moves to the background.
- **Works everywhere**: Pass any `Brush` or `ShaderBrush` to `Modifier.background(brush)` or any `DrawScope` primitive (`drawRect`, `drawRoundRect`, `drawCircle`, `drawArc`).
# Layout, Modifiers & Insets (https://crow.build/docs/ui/layout)
**`crow-ui`** is Crow's native Android rendering engine. Every container maps directly to a compact `LNode` backed by hardware `RenderNode` display-list chunks, incremental linear layout, and measure caching.
## Core Containers [#core-containers]
Crow provides the familiar declarative layout primitives:
- **`Box`** — stacked layers with `contentAlignment` (`Alignment.Center`, `Alignment.BottomEnd`, etc.) and `Modifier.align(...)`.
- **`Row` & `Column`** — linear layout with `horizontalArrangement` / `verticalArrangement`, `Arrangement.spacedBy(12.dp)`, cross-axis alignment, and `Modifier.weight(1f)`.
- **`FlowRow`** — wrapping horizontal chips and tags with spacing.
- **`VerticalScroll` & `HorizontalScroll`** — axis-locked scroll containers with Android 12+ RenderNode stretch overscroll, `ScrollState`, and `NestedScrollConnection`.
## Order-Dependent Modifiers [#order-dependent-modifiers]
Modifiers execute in declaration order, matching Jetpack Compose semantics while fusing zero-allocation fast paths at compile time:
```kotlin
Box(
Modifier
.fillMaxWidth()
.padding(16.dp) // outer margin (before background)
.clip(RoundedCornerShape(16.dp))
.background(SurfaceColor)
.border(1.dp, BorderColor, RoundedCornerShape(16.dp))
.clickable { openDetails() }
.padding(horizontal = 20.dp, vertical = 14.dp), // inner padding
) {
Text("Tap to open")
}
```
### Sizing & Callbacks [#sizing--callbacks]
- Fixed & constrained sizing: `size`, `width`, `height`, `fillMaxSize`, `fillMaxWidth`, `fillMaxHeight`, `widthIn`, `heightIn`, `sizeIn`, `defaultMinSize`, `requiredSize`, `wrapContentSize`, `aspectRatio`.
- Live reactive sizing: `height { if (open) 240.dp else 72.dp }` re-measures only in the layout phase with zero remounting.
- Placement callbacks: `onSizeChanged`, `onPlaced`, `onGloballyPositioned`, and `BringIntoViewRequester` — callbacks never fire mid-measure.
## Reactive Window Insets [#reactive-window-insets]
Window insets (status bars, navigation bars, IME keyboard, display cutouts, system gestures) are reactive signals in `UiEnv`:
```kotlin
Column(
Modifier
.fillMaxSize()
.safeDrawingPadding()
.imePadding(),
) {
// Reacts to keyboard open/close and rotation in the layout phase only
}
```
Use `statusBarsPadding()`, `navigationBarsPadding()`, `systemBarsPadding()`, `imePadding()`, `displayCutoutPadding()`, or `safeDrawingPadding()`. They fuse just like static padding and update only the affected node on inset changes.
## `Scaffold` & Scroll Choreography [#scaffold--scroll-choreography]
`ScaffoldBase` (and Material's `Scaffold`) coordinates top bars, bottom bars, FABs, and scroll behaviors with automatic inset distribution and **zero per-frame relayout**:
- **Overlay + coupled scroll**: Bars follow content scroll position in the layer phase (`Pinned`, `ScrollAway`, `Collapsible`, `Floating`, `FloatingCollapsible`) with velocity-aware settling.
- **FAB coordination**: `expandedByScroll()` smoothly collapses extended FABs as the user scrolls and keeps the FAB docked above hiding navigation bars.
# Lazy Lists, Grids & Pagers (https://crow.build/docs/ui/lists)
Crow's virtualized layouts share a renderer-agnostic, property-fuzzed layout algorithm (`LazyListLayout` / `LazyGridLayout` in `crow-runtime`) so only visible items (plus a configurable mount-ahead prefetch window) ever exist in memory.
## `LazyColumn` & `LazyRow` [#lazycolumn--lazyrow]
Use the `LazyListScope` DSL (`pinnedHeader`, `stickyHeader`, `item`, `items`, `itemsIndexed`, `empty`):
```kotlin
LazyColumn(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 12.dp),
) {
stickyHeader(key = "header-today") {
SectionHeader("Today")
}
items(brews, key = { it.id }) { brew ->
BrewCard(brew, modifier = Modifier.padding(bottom = 10.dp))
}
}
```
### Key Guarantees [#key-guarantees]
- **Anchor preservation**: Prepending items above the current viewport keeps the visible anchor rock-steady without jumping.
- **In-place item updates**: Because `@Ui` lambda parameters are live props, updating a row's data updates only the bound leaf properties without remounting the item.
- **Layer-phase `stickyHeader`**: Sticky headers pin and push out in the layer phase with zero relayout per scroll frame.
- **Dormant off-screen retention**: Recently scrolled-out items within half a viewport stay mounted in an inactive owner (effects paused) so fast back-and-forth flings stay silky smooth at 120 Hz.
- **RenderNode stretch overscroll**: Overscroll runs in the draw phase inside its own `RenderNode`, so pinned headers never distort.
## `LazyVerticalGrid` [#lazyverticalgrid]
Build multi-column grids with fixed column counts and item spacing:
```kotlin
LazyVerticalGrid(
items = pokemon,
columns = 2,
key = { it.id },
modifier = Modifier.fillMaxSize().padding(12.dp),
horizontalSpacing = 12.dp,
verticalSpacing = 12.dp,
) { entry ->
PokemonCard(entry)
}
```
## `HorizontalPager` & `VerticalPager` [#horizontalpager--verticalpager]
Signal-first pagers with velocity-continuous spring snapping, lazy mounting, and peeking carousels via `contentPadding`:
```kotlin
val pager = PagerState(pageCount = { slides.size })
HorizontalPager(
state = pager,
contentPadding = PaddingValues(horizontal = 32.dp),
pageSpacing = 12.dp,
) { page ->
Box(
Modifier
.fillMaxWidth()
.graphicsLayer {
val offset = pager.offsetForPage(page).absoluteValue.coerceIn(0f, 1f)
scale = 1f - offset * 0.08f
alpha = 1f - offset * 0.35f
},
) {
SlideCard(slides[page])
}
}
```
Because `pager.offsetForPage(page)` and `pager.currentPageOffsetFraction` are immediate-lane signals read inside `graphicsLayer { }`, parallax and carousel scaling execute purely in the GPU layer phase with **zero recomposition and zero layout passes**.
# Motion, Shared Elements & Predictive Back (https://crow.build/docs/ui/motion)
`crow-motion` is Crow's platform-free animation engine. Springs are **analytic** (closed-form position and velocity at any timestamp), **interruptible by default**, and backed by **`Lane.Immediate` external signals** so animations never stall during async transitions and bypass the reactive tree walk completely.
## Analytic Springs & `animateFloat` [#analytic-springs--animatefloat]
Define springs with intuitive `duration` and `bounce` parameters (no manual stiffness/damping math needed):
```kotlin
var expanded by signal(false)
val progress = animateFloat(spring = Spring.Bouncy) {
if (expanded) 1f else 0f
}
Box(
Modifier
.size(96.dp)
.graphicsLayer {
val p = progress.value
scale = 1f + p * 0.15f
rotation = p * 12f
}
.clickable { expanded = !expanded },
)
```
- **Nothing animates on the first frame**: `animateFloat` starts settled at its initial target.
- **Velocity-preserving retargets**: Flip `expanded` mid-flight and the spring preserves exact position and momentum — no jumps, no discontinuities.
- **Layers-only frames**: When a Choreographer tick writes only `graphicsLayer` properties (`alpha`, `scaleX`, `scaleY`, `translationX`, `translationY`, `rotation`), Crow UI updates the `RenderNode` directly without visiting the node tree.
For imperative gesture-driven motion, use `Animatable(initial)` with `animateTo(...)`, `snapTo(...)`, and `velocity`.
## `AnimatedVisibility` & Exit Ghosts [#animatedvisibility--exit-ghosts]
`AnimatedVisibility` keeps exiting subtrees alive as **exit ghosts** — inert to touch input while animating out, and smoothly revived mid-exit with their velocity and state intact if the condition flips back:
```kotlin
var showBanner by signal(false)
AnimatedVisibility(visible = showBanner, transition = VisibilityTransition.Rise) {
Surface(Modifier.fillMaxWidth()) {
Text("Springs in and out on GPU layers — tap again mid-flight to reverse.")
}
}
```
## Shared-Element Flights (`Modifier.sharedElement`) [#shared-element-flights-modifiersharedelement]
Tag matching elements across two screens (such as a card's artwork in a grid and the hero banner on its detail screen) with the same key:
```kotlin
// On HomeScreen
Image(
source = pokemon.imageUrl,
contentDescription = pokemon.name,
modifier = Modifier
.size(120.dp)
.sharedElement("pokemon-${pokemon.id}"),
)
// On DetailsScreen
Image(
source = pokemon.imageUrl,
contentDescription = pokemon.name,
modifier = Modifier
.size(220.dp)
.sharedElement("pokemon-${pokemon.id}"),
)
```
Crow animates the bounds and position seamlessly between destinations — and turns around smoothly mid-flight if the user presses back early.
## Predictive Back (1:1 Finger Tracking) [#predictive-back-11-finger-tracking]
Crow integrates natively with Android's `OnBackAnimationCallback` (API 34+) and `BackDispatcher`:
- Dragging from the screen edge wakes the destination underneath (inert) and drives `NavTransition.seek(progress)` 1:1 with the finger.
- Releasing to commit hands the gesture's exact velocity into the settling spring.
- Cancelling springs both screens cleanly back to rest.
- Register custom preview-aware handlers anywhere with `onBack(preview = { ... }) { ... }`. When nothing consumes back, Crow yields immediately so the OS back-to-home animation plays naturally.
# Styles, Overlays & Unstyled Components (https://crow.build/docs/ui/styling)
Crow enforces a strict separation between **behavior** and **visual design**. Core modules never depend on Material 3 or Lens (`checkCoreIndependence`). Instead, `crow-ui` ships a high-performance style engine (`crow.style`), unstyled component bases, and a unified overlay layer.
## `crow-style`: Immutable Styles with Per-State Springs [#crow-style-immutable-styles-with-per-state-springs]
Define visual styling as composable `Style` values with state blocks (`pressed`, `focused`, `focusVisible`, `hovered`, `dragged`, `selected`, `disabled`, `error`) resolved in fixed precedence:
```kotlin
private val PrimaryPill = style {
background { LocalTheme.current.accent }
contentColor { LocalTheme.current.onAccent }
shape(RoundedCornerShape(999.dp))
padding(horizontal = 20.dp, vertical = 12.dp)
hovered { overlay(0x14FFFFFF) }
pressed { scale(0.96f); overlay(0x26FFFFFF) }
disabled {
background { LocalTheme.current.surfaceMuted }
contentColor { LocalTheme.current.textMuted }
}
}
```
Compose styles with `+` (deep-merging state blocks cleanly):
```kotlin
val DestructivePill = PrimaryPill + style {
background(0xFFDC2626.toInt())
}
```
### Why It's Fast [#why-its-fast]
- All eight interactive states live in a single immediate-lane bitmask (`Interaction`).
- `Modifier.style(style, interaction)` creates **at most one binding per render phase** (draw, layer, layout).
- Colors interpolate in **premultiplied OKLab**, and scale/offset/overlay springs run directly inside the node with **zero graph flushes per frame**.
- Token lambdas (`background { ... }`) evaluate when applied, so top-level `val` styles automatically follow live dark/light theme switches.
## Unstyled Components (Bases) [#unstyled-components-bases]
Core ships accessible, keyboard-aware unstyled bases that wire `Interaction`, semantics roles, focus, and cascading `LocalContentColor` / `LocalTextStyle`:
- **`ButtonBase`** — clickable action with disabled press cancellation
- **`ToggleBase`**, **`SwitchBase`**, **`CheckboxBase`**, **`RadioButtonBase`**, **`RadioGroup`** — selection & checked states
- **`DialogBase`**, **`PopupBase`**, **`SheetBase`**, **`BalloonBase`**, **`SpotlightScrim`** — modal & anchored surfaces
```kotlin
ButtonBase(
onClick = { saveDraft() },
style = PrimaryPill,
enabled = canSave,
) {
Text("Save Draft")
}
```
## The `Overlay` Primitive [#the-overlay-primitive]
Dialogs, bottom sheets, popups, tooltips, menus, and snackbars all render on `CrowView`'s unified overlay layer — **never** leaky separate `PopupWindow`s:
- **Lexical owner & contexts**: An `Overlay` inherits the owner and `Context` values of its declaration site while rendering above all content.
- **Entering / Open / Exiting**: Reopening a sheet or dialog mid-exit reverses the same overlay seamlessly.
- **Back & focus stacking**: Overlays capture system back in stack order, cancel touches beneath, suspend IME focus when opening, and restore focus to the opener on close.
- **Same-frame anchored placement**: `PopupBase` and `BalloonBase` recompute flip/shift/RTL positioning right before draw so anchored popovers track scrolls without a single frame of lag.
# Text Input & Crow Image (https://crow.build/docs/ui/text-and-images)
## Text Input (`TextState` & `TextField`) [#text-input-textstate--textfield]
Crow's text engine separates pure-JVM editing state (`TextState` in `crow-runtime`) from Android's direct `InputConnection` bridge (`TextFieldNode` in `crow-ui`).
```kotlin
@Ui
fun LoginForm() {
val email = saved("")
val password = signal("")
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
TextField(
value = email,
placeholder = { Text("you@domain.com") },
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
)
TextField(
value = password,
placeholder = { Text("Password") },
outputTransformation = PasswordTransformation(),
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
)
}
}
```
### Capabilities [#capabilities]
- **Immediate-lane responsiveness**: Text content, selection range, and IME composition spans are tracked independently on `Lane.Immediate` so typing never stalls behind held network transitions.
- **Atomic edits & undo**: `TextState` supports nested batched edits, `maxLength`, `InputTransformation`, merged typing undo history, and surrogate/grapheme-safe cursor motion.
- **Visual output transformations**: `PasswordTransformation` and `GroupingTransformation` (e.g., credit cards, phone numbers) map visual-to-logical offsets accurately for selection and carets.
- **Zero-flicker focus handoff**: Moving focus between two `TextField`s keeps the soft keyboard smoothly open and updates `InputConnection` in place.
## Images (`crow-image`) [#images-crow-image]
`crow-image` combines a platform-free `ImageEngine` (byte-budgeted LRU memory cache, weak cache, variant reuse, request coalescing, cancellation, and prioritized prefetch) with an Android `ImageLoader` supporting cover-size decoding, **API 29+ hardware bitmaps**, atomic SHA-256 disk caching, EXIF orientation, and animated GIF/WebP playback.
```kotlin
Image(
source = item.coverUrl,
contentDescription = item.title,
modifier = Modifier
.size(120.dp)
.clip(RoundedCornerShape(16.dp)),
contentScale = ContentScale.Crop,
)
```
### Images Inside `Loading` Boundaries (`imageResource`) [#images-inside-loading-boundaries-imageresource]
Unlike external image libraries, Crow images can participate in the exact same `Loading` boundaries and held route transitions as your API data:
```kotlin
Loading(fallback = { CardSkeleton() }) {
val cover = imageResource(item.heroUrl, widthPx = 800, heightPx = 450)
HeroHeader(cover.value)
}
```
- **Memory cache hits settle synchronously** on the first frame — zero placeholder flash.
- **Hardware decoding** matches the node's measured bounds without upscaling.
- **Animated GIF & WebP** pause automatically while scrolled off-screen or while their screen is dormant in the back stack.
- **Draw-phase arrival**: When a network image finishes decoding, only that `ImageNode` invalidates its draw pass.
# Crow 0.1 Preview (Upcoming) (https://crow.build/changelog/2026-11-30-0-1-preview)
## Crow 0.1 Preview (Upcoming) [#crow-01-preview-upcoming]
The first public preview of **Crow** will publish under the Maven group `build.crow` (from `crow-build/crow`, with documentation at `crow.build`) alongside prebuilt `crow` CLI binaries on GitHub Releases and the `crow.app` Gradle plugin.
### Core & Compiler (Pure JVM) [#core--compiler-pure-jvm]
- **`crow-signals`**: Solid 2.0–style push-pull fine-grained reactive graph with sync/async semantics, split effects, transactional `action`, optimistic overlays, `until`/`resolve`, and `Owner` ownership trees.
- **`crow-compiler`** (K2 FIR + IR): Zero-recomposition lowering (`UiScopeLowering`, `LocalGraph` bitmask state, direct leaf bindings), `CR1001`–`CR1003` and `CR2001`–`CR2007` compile-time diagnostics, compiler-assigned `saved()` keys, dev-only hot-reload shell lowering, and direct-call `crow-inject` codegen.
- **`crow-runtime`**: `@Ui`, `@CrowApp`, `@CrowApplication`, `ProcessHost`, `BackStack`, `NavHost`, predictive `BackDispatcher`, `TextState`, `SavedStateRegistry`, and `HotRegistry`.
### Zero-Glue Application Stack [#zero-glue-application-stack]
- **`crow-router`** + `crow.routes` / `crow-codegen` for typed file-based routing, tabs, guards, deep links, and saved stacks.
- **`crow-query`** for typed server-state caching, `Resource` integration, optimistic mutations, and `infiniteQuery`.
- **`crow-store`** for `ReactiveStore`, `StoreCodec`, `StoreCollection`, `StoreIndex`, crash-safe WAL/ACID `FileStoreBackend`, and `AndroidKeyStore`-backed `SecretStore`.
- **`crow-state`**, **`crow-schema`**, **`crow-inject`**, **`crow-image`**, **`crow-color`**, and **`crow-motion`** — all speaking the same signal graph and ownership tree.
### Android-Native UI & Optional Design Systems [#android-native-ui--optional-design-systems]
- **`crow-ui`**: Direct Android HWUI `RenderNode` retained engine, fused modifiers, `LazyColumn`/`LazyRow`/`LazyVerticalGrid`, `HorizontalPager`/`VerticalPager`, `TextField` + direct `InputConnection`, API 30+ 1:1 `WindowInsetsAnimation`, overlay primitives, unstyled `*Base` controls, `crow-style` OKLab state engine, shared elements and container transforms, AGSL `ShaderBrush` and Liquid Glass (`Modifier.glass`, `GlassGroup`), TalkBack `AccessibilityNodeProvider`, and zero-AndroidX `CrowActivity`/`CrowApplication`.
- **`crow-media`**, **`crow-guide`**, and **`crow-symbols`** (3,893 Material Symbols variable-font icons with build-time subsetting).
- **`crow-material3`** (Material 3 Expressive + dynamic wallpaper color) and **`crow-lens`** (shadcn × tactile Liquid Glass, optional and built strictly on Crow's public building blocks).
### Build Loop, Hot Reload & Testing [#build-loop-hot-reload--testing]
- **Two build paths, one `crow.jsonc`**: `crow-build` + native Rust `crow` CLI + `crow-daemon` + stdio `crow mcp` server for the zero-Gradle dev loop and state-preserving delta-DEX hot reload (`crow-live` / `crow-live-android`), and Gradle `crow.app` + AGP for release builds, AABs, and Android Studio.
- **`crow-ui-test`**: Headless Robolectric NATIVE PNG rendering, semantics tree dumps, scripted input, and reactive leak assertions.