Skip to content

feat(rune-kit): add TextArea::plain, trailing, and scroll_bar / scroll_bar_styled - #1967

Merged
Hona merged 1 commit into
devfrom
feat/286-textarea-plain-trailing-scrollbar
Nov 24, 2026
Merged

Hona merged 1 commit into
devfrom
feat/286-textarea-plain-trailing-scrollbar

Conversation

@Hona

@Hona Hona commented Nov 24, 2026

Copy link
Copy Markdown
Member

Fixes #286
Fixes #908
Fixes #1638

Adds three opt-in chrome and layout builders to rune_kit::TextArea, leaving default TextArea layout and visuals unchanged:

  • TextArea::plain(self) -> Self: omits box chrome (fill, elevation, hover tint, border, focus outline) so a custom container such as a chat composer 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). Mirrors TextInput::plain (crates/rune-kit/src/controls/text_input/mod.rs).
  • TextArea::trailing(self, e: El) -> Self: switches the outer role("textbox") container to a row() with an 8 pt gap, gives the editable viewport .grow(1.0).shrink().min_w(0.0) so text wraps clear of the accessory and scrolls inside auto_grow / max_height, and anchors row().key("trailing").self_end().child(e) at the bottom-end so the accessory remains independently focusable and clickable. Mirrors TextInput::trailing / TextField::trailing and CSS flex input-group layout.
  • TextArea::scroll_bar(self, on: bool) -> Self and TextArea::scroll_bar_styled(self, style: ScrollBarStyle) -> Self: wraps the internal "scroll" viewport created by auto_grow or max_height with ScrollBar::scroll_bar_styled (no-op when neither is set; off by default). Mirrors Tree::scroll_bar / Tree::scroll_bar_styled (crates/rune-kit/src/tree/view.rs) and ScrollBar.
  • Split crates/rune-kit/src/controls/text_input.rs into controls/text_input/{mod,area,field}.rs to keep every file under the 800-line cap.
flowchart LR
  Box["role(textbox) row · padding 8 · gap 8"] --> Area["scroll-scroll-area · grow(1) shrink min_w(0)"]
  Box --> Trail["key(trailing) · self_end"]
  Area --> VP["key(scroll) · auto_grow / max_height"]
  Area --> Bar["key(scroll-bar) · a11y_hidden"]
  VP --> In["key(input) · text_input"]
  Trail --> Btn["trailing El (e.g. Send / Commit button)"]
Loading
TextArea::new(&s.draft)
    .label("Message")
    .plain()
    .width(None)
    .auto_grow(1, 4)
    .scroll_bar(true)
    .trailing(Button::new("Send").on_press(|s: &mut App| s.send()).build(&k))
    .on_edit(|s: &mut App| &mut s.draft)
    .build(&k)

Where to see it

  • examples/kit-gallery scene rune-textarea--composer (borderless plain composer, trailing Commit button beside an auto-growing scroll viewport, and max_height with a custom ScrollBarStyle).

Not checked

  • Not visually inspected in a live desktop window or on iOS/physical devices (headless tests and cross-platform compiles only).

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

Labels

None yet

Projects

None yet

1 participant