Skip to content

TextArea: no plain mode, so a container can't draw its own box around a multi-line field #286

Done

Description

@vaporwavie

TextInput::plain drops the field's box (fill, radius, shadow, border, hover tint, focus outline) so a container can draw its own. TextArea has no equivalent, so a chat-style composer that wants one box around the text and a footer row below it ends up with a box inside a box.

This showed up in whodunit, a desktop app I'm building on Rune. Its composer is a rounded container with an auto-growing TextArea and a row of controls underneath. The kit draws the TextArea's border and focus ring inside the container's box.

Using:

  • rune dev at a7f276c3
  • macOS 27.2, Rust 1.99.1

Minimal reproduction

use rune::{Cx, El, TextEdit, col, row};
use rune_kit::{Kit, TextArea};

struct S { draft: TextEdit }

fn view(s: &S, _: &mut Cx<S>) -> El {
    let k = Kit::neutral(true);
    // The composer draws its own box and holds a footer under the text.
    col().role("textbox").padding(8.0).fill(k.c.layer_01).radius(12.0)
        .child(
            TextArea::new(&s.draft)
                .auto_grow(1, 8)
                .width(None)
                // .plain()   <- what I'd want, as on TextInput
                .on_edit(|s: &mut S| &mut s.draft)
                .build(&k),
        )
        .child(row().h(28.0)) // footer: model picker, send button…
}

The TextArea paints its own fill, border and focus outline inside the composer's box.

Expected behavior

TextArea::plain() behaves like TextInput::plain(): no box, the inner padding stays, focus shows as the caret, an invalid area as red text, and a disabled one dims.

My take

I've been running this patch in my app. It adds a plain flag that skips shell(...) in TextArea::build and wraps a disabled area in layer_opacity(0.5). An invalid plain area gets red text even when the kit's invalid_text is off, since there's no outline left to show it. It's about 15 lines and copies what TextInput::plain does.

I thought about opening a PR for it, but since it was found during an experiment, I figured having an issue created first would make more sense.
There's probably additional work needed to fix tests and whatever I may have broken during patches.

Thanks!

Activity

  1. Hona commented on Nov 24, 2026

    @Hona
    Member

    Implemented on dev in #1967 (0c85015b7).

    TextArea::plain() omits the field's box chrome (fill, elevation, hover tint, border, and focus outline) so a custom composer container can draw its own box, while keeping 8 pt inner padding, press-anywhere focus, invalid red text even when Kit::invalid_text is false, Kit::disabled_dim, and the 2 pt forced-colors focus outline (Kit::forced). It follows TextInput::plain() in crates/rune-kit/src/controls/text_input/mod.rs, and is shown in examples/kit-gallery scene rune-textarea--composer.

    col().role("textbox").fill(k.c.layer_01).radius(k.radius.lg).child(
        TextArea::new(&s.draft)
            .label("Message")
            .plain().auto_grow(1, 8).width(None)
            .on_edit(|s: &mut App| &mut s.draft).build(&k),
    )

    Tested with headless Runtime integration and accessibility tests in crates/rune-kit/tests/integration/text_area_chrome.rs and crates/rune-kit/tests/a11y/controls.rs on Windows and macOS, plus Linux cargo check --tests, kit-gallery build tests, and wasm32 checks. Not visually inspected in a live desktop window or on physical devices. If anything behaves unexpectedly in your composer, please feel free to reopen or comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions