Tooltip can be used to show a message when hovering over an element.
Base Tooltip
Exported source
tooltip = SingleValueFactory("tooltip", "Base tooltip component") # Base tooltip componenttooltip_content = SingleValueFactory("tooltip-content", "Optional. Setting a div as the content of the tooltip instead of the `data-tip` text") # Base tooltip content part
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Tooltip Colors
Tooltip Test Examples
test_tooltip_basic_examples
def test_tooltip_basic_examples():
Test basic tooltip utilities.
Exported source
def test_tooltip_basic_examples():"""Test basic tooltip utilities."""# Basic tooltipassertstr(tooltip) =="tooltip"assertstr(tooltip_content) =="tooltip-content"# Test with modifiersassertstr(tooltip.hover) =="hover:tooltip"assertstr(tooltip.md) =="md:tooltip"assertstr(tooltip.dark) =="dark:tooltip"# Run the teststest_tooltip_basic_examples()
test_tooltip_placement_examples
def test_tooltip_placement_examples():
Test tooltip placement options.
Exported source
def test_tooltip_placement_examples():"""Test tooltip placement options."""assertstr(tooltip_placement.top) =="tooltip-top"assertstr(tooltip_placement.bottom) =="tooltip-bottom"assertstr(tooltip_placement.left) =="tooltip-left"assertstr(tooltip_placement.right) =="tooltip-right"# Run the teststest_tooltip_placement_examples()
test_tooltip_modifiers_examples
def test_tooltip_modifiers_examples():
Test tooltip modifier utilities.
Exported source
def test_tooltip_modifiers_examples():"""Test tooltip modifier utilities."""assertstr(tooltip_modifiers.open) =="tooltip-open"# Run the teststest_tooltip_modifiers_examples()
test_tooltip_colors_examples
def test_tooltip_colors_examples():
Test tooltip color variants.
Exported source
def test_tooltip_colors_examples():"""Test tooltip color variants."""# All color variantsassertstr(tooltip_colors.neutral) =="tooltip-neutral"assertstr(tooltip_colors.primary) =="tooltip-primary"assertstr(tooltip_colors.secondary) =="tooltip-secondary"assertstr(tooltip_colors.accent) =="tooltip-accent"assertstr(tooltip_colors.info) =="tooltip-info"assertstr(tooltip_colors.success) =="tooltip-success"assertstr(tooltip_colors.warning) =="tooltip-warning"assertstr(tooltip_colors.error) =="tooltip-error"# With modifiersassertstr(tooltip_colors.primary.hover) =="hover:tooltip-primary"assertstr(tooltip_colors.success.focus) =="focus:tooltip-success"# Run the teststest_tooltip_colors_examples()
test_tooltip_basic_fasthtml_examples
def test_tooltip_basic_fasthtml_examples():
Test basic tooltip examples from daisyUI v5 documentation.