# 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.