Incular logoIncular
API ReferenceText & Media

SelectableRegion

Pointer-based text selection area without a mutable buffer.

SelectableRegion is the retained selection primitive: no mutable text buffer, caret, or IME route. Material SelectableText and SelectionArea descriptors wrap it.

use incular::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(SelectableRegion::new(Text::new(
                "Drag across this text to select it.",
            )))
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Selection rectangles derive from cached Parley-backed layout (wrapped, mixed-font, bidirectional); selection changes repaint highlights without reshaping glyphs. Keep a SelectionAreaController when application code needs the copied selection.

Related: EditableText, Text.