gpuicn
Theme

Theme the previews

Every preview on the site is live GPUI and follows these.

Base
Accent
Radius
gpuicn theme set --base-color neutral --radius 0.625rem

Forms

Textarea

A styled multi-line editor backed by native GPUI editing.

Added in 0.5.0 10 lines of Rust

Gallery

Starting the preview. GPUI compiles to WebAssembly, so the first load takes a few seconds. This browser has neither WebGPU nor WebGL 2, so the live preview cannot run. The code on this page still works. The preview did not start.

Installation

After the one-time setup, run the command from your app root. The CLI writes the modules and keeps src/ui/mod.rs in step.

gpuicn add textarea

If you prefer to copy the files by hand, declare them yourself:

// src/ui/mod.rs
pub mod theme;
pub mod input;
pub mod textarea;

// src/main.rs
mod ui;

Usage

Put this in a view module and return example(window, cx) from its render method.

use crate::ui::textarea::*;
use gpui_kit::{App, IntoElement, Window};

fn example(window: &mut Window, cx: &mut App) -> impl IntoElement {
    let state = window.use_keyed_state("message", cx, |window, cx| {
        TextareaState::new(window, cx)
            .rows(4)
            .placeholder("Write a message")
    });
    textarea(&state).aria_label("Message")
}

Examples

Rows

The state sets how many rows show before the text scrolls.

Starting the preview. GPUI compiles to WebAssembly, so the first load takes a few seconds. This browser has neither WebGPU nor WebGL 2, so the live preview cannot run. The code on this page still works. The preview did not start.

In a field

A field gives the textarea a label and a description.

Starting the preview. GPUI compiles to WebAssembly, so the first load takes a few seconds. This browser has neither WebGPU nor WebGL 2, so the live preview cannot run. The code on this page still works. The preview did not start.

API reference

pub fn textarea(state: &Entity<TextareaState>) -> Textarea

Creates a textarea using the caller's retained editing state.

Installed source, 10 lines
//! Discoverable Nova textarea built on the shared Kit-backed input source.

pub use super::input::{Textarea, TextareaState};
use gpui_kit::Entity;

/// Creates a textarea using the caller's retained editing state.
pub fn textarea(state: &Entity<TextareaState>) -> Textarea {
    Textarea::new(state)
}

Platform notes

Visual reference: shadcn/ui 4.19.0, Neutral Nova. Implementation: crates/ui/registry/textarea/textarea.rs, backed by crates/ui/registry/input/input.rs and GPUI Kit 0.6.4.

Textarea uses caller-owned TextareaState and supports the same disabled, read-only, invalid, paste interception, history, clipboard and IME behavior as Input. It composes with Field for a visible label, description and validation message. Rows set the starting height; content scrolls inside the native editor.

Image or file paste interception is synchronous on native platforms. Browser clipboard access for those payloads needs an async permission flow and remains outside this API. Native OS IME and screen-reader workflows require device checks.