Skip to main content

Module textarea

Module textarea 

Source
Available on crate feature textarea only.
Expand description

Multi-line text editing.

A tap places the caret and a vertical drag scrolls the text, as with the mouse, so a textarea works on a touch screen.

Undo, redo, word deletion and Escape follow the same Shortcuts as inputs. Undo sends ordinary Actions, so an app that applies each action to its Content needs no changes. Switch some or all of them off by passing a Shortcuts set to Textarea::shortcuts.

The app owns the Content and applies each Action in update:

use iced::widget::text_editor::{Action, Content};
use iced_cube::textarea;

#[derive(Debug, Clone)]
enum Message { Edit(Action) }

let content = Content::new();
let view: iced::Element<'_, Message> = textarea(&content)
    .placeholder("Write a note")
    .on_action(Message::Edit)
    .into();

Re-exports§

pub use crate::primitives::input::Shortcut;
pub use crate::primitives::input::Shortcuts;

Structs§

Content
The content of a TextEditor.
Textarea
A textarea builder. Convert it into an Element to render.

Enums§

Action
An interaction with an Editor.

Constants§

MIN_HEIGHT
Minimum height while the height is Length::Shrink, roughly three lines.

Functions§

style
The iced text editor style for a status, matching the input’s look.
textarea
Creates a textarea editing content.