pub fn LinkedText(
text: impl Into<Rc<AnnotatedString>>,
modifier: Modifier,
style: TextStyle,
open_url: impl Fn(&str) + 'static,
) -> NodeIdExpand description
Displays annotated text and dispatches each link action. A URL annotation
calls open_url; a clickable annotation calls its own handler. A shared
Rc<AnnotatedString> retains the prepared text across uses.
ยงExample
use cranpose_ui::{text::AnnotatedString, *};
#[composable]
fn WebsiteLink() {
let text = AnnotatedString::builder()
.append("Visit ")
.with_link(
LinkAnnotation::Url("https://example.com".into()),
|builder| builder.append("the website"),
)
.to_annotated_string();
LinkedText(text, Modifier::empty(), TextStyle::default(), |url| {
println!("Open URL: {url}");
});
}An app can pass a callback from the platform URI service to open the URL.