Function cosmic::iced_widget::rich_text
source · pub fn rich_text<'a, Link, Theme, Renderer>(
spans: impl AsRef<[Span<'a, Link, <Renderer as Renderer>::Font>]> + 'a,
) -> Rich<'a, Link, Theme, Renderer>
Expand description
Creates a new Rich
text widget with the provided spans.
§Example
use iced::font;
use iced::widget::{rich_text, span};
use iced::{color, Font};
#[derive(Debug, Clone)]
enum Message {
// ...
}
fn view(state: &State) -> Element<'_, Message> {
rich_text([
span("I am red!").color(color!(0xff0000)),
span(" "),
span("And I am bold!").font(Font { weight: font::Weight::Bold, ..Font::default() }),
])
.size(20)
.into()
}