Components / RichText
RichText
Bold, italic, code and links in plain text, with the marks chat apps use.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn rich_text() -> impl View {
let opened = State::new(String::from("No link opened yet"));
let told = opened.clone();
VStack::new((
RichText::new(
"*Ready:* _your order_ ~left~ is at `Desk 4`.\n* Details at https://example.com/orders\n> Open until six",
)
.on_link(move |address| told.set(format!("Asked to open {address}"))),
Text::bound(&opened, Clone::clone).style(TextStyle::Caption).foreground(Semantic::InkMuted),
))
.spacing(8.0)
.align(Align::Stretch)
.width(360.0)
}