nightshade_api/web/base/tooltip.rs
1use leptos::prelude::*;
2
3/// Wraps `children` in a focusable span that reveals `text` in a bubble on
4/// hover or focus.
5#[component]
6pub fn Tooltip(#[prop(into)] text: String, children: Children) -> impl IntoView {
7 view! {
8 <span class="nightshade-tooltip" tabindex="0">
9 {children()}
10 <span class="nightshade-tooltip-bubble" role="tooltip">
11 {text}
12 </span>
13 </span>
14 }
15}