From 654ae0bf5d7165be7919d8cfd502184bdf0af0a6 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Mon, 29 Jun 2026 18:12:16 -0600 Subject: [PATCH] chore: add typography presets for selectable_text --- src/widget/selectable_text.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/widget/selectable_text.rs b/src/widget/selectable_text.rs index 824077c7..5bd85ed4 100644 --- a/src/widget/selectable_text.rs +++ b/src/widget/selectable_text.rs @@ -503,3 +503,23 @@ impl<'a, Message: Clone + 'static> From> for crate::Element<' pub fn selectable_text<'a>(content: impl Into> + 'a) -> SelectableText<'a> { SelectableText::new(content.into()).font(crate::font::default()) } + +// Typography presets, mirroring [`crate::widget::text`] +macro_rules! selectable_preset { + ($(#[$meta:meta])* $name:ident) => { + $(#[$meta])* + pub fn $name<'a>(content: impl Into> + 'a) -> SelectableText<'a> { + SelectableText::from(crate::widget::text::$name(content)) + } + }; +} + +selectable_preset!(title1); +selectable_preset!(title2); +selectable_preset!(title3); +selectable_preset!(title4); +selectable_preset!(heading); +selectable_preset!(caption_heading); +selectable_preset!(body); +selectable_preset!(caption); +selectable_preset!(monotext);