glaze/basecoat/tooltip
Basecoat documentation: https://basecoatui.com/components/tooltip/
Tooltip helpers for short helper text on interactive elements.
Note: This component requires JavaScript from Basecoat.
Anatomy
A tooltip setup usually includes a trigger element and a content panel.
Recipe
import glaze/basecoat/tooltip
import lustre/element/html
fn my_tooltip() {
tooltip.tooltip("my-tooltip", [
tooltip.trigger([], [html.text("Hover me")]),
tooltip.content([], [html.text("Tooltip text")]),
])
}
References
- MDN ARIA
tooltiprole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/tooltip_role - MDN Popover API: https://developer.mozilla.org/en-US/docs/Web/API/Popover_API
Values
pub fn align(a: String) -> attribute.Attribute(msg)
pub fn align_center() -> attribute.Attribute(msg)
pub fn align_end() -> attribute.Attribute(msg)
pub fn align_start() -> attribute.Attribute(msg)
pub fn content(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn content_with_id(
tooltip_id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn side(s: String) -> attribute.Attribute(msg)
pub fn side_bottom() -> attribute.Attribute(msg)
pub fn side_left() -> attribute.Attribute(msg)
pub fn side_right() -> attribute.Attribute(msg)
pub fn side_top() -> attribute.Attribute(msg)
pub fn tooltip(
id: String,
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn trigger(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn trigger_with_id(
tooltip_id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)