basecoat_core/props/
tooltip.rs1use crate::{AttrMap, BasecoatProps, Children};
2use std::borrow::Cow;
3
4#[derive(Clone, Debug, PartialEq, Eq, Default)]
8pub enum TooltipSide {
9 #[default]
10 Top,
11 Right,
12 Bottom,
13 Left,
14}
15
16impl std::fmt::Display for TooltipSide {
17 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18 let s = match self {
19 TooltipSide::Top => "top",
20 TooltipSide::Right => "right",
21 TooltipSide::Bottom => "bottom",
22 TooltipSide::Left => "left",
23 };
24 f.write_str(s)
25 }
26}
27
28#[derive(BasecoatProps, Default, Clone, Debug)]
31pub struct TooltipProps {
32 #[prop(into)]
34 pub content: Cow<'static, str>,
35 #[prop(default)]
36 pub side: TooltipSide,
37 #[prop(optional, into)]
38 pub class: Option<Cow<'static, str>>,
39 #[prop(extend)]
40 pub attrs: AttrMap,
41 pub children: Children,
43}