For InteractiveTooltip make sure to reuse an existing icon (not copying SVG code).
The IconTooltip should support any Icon element.
When implementing the code, please only set the minium of required attributes. For example, id-attributes or aria-attributes are not required in most casts. class and data-* attributes are almost always required.
The __init__ methods of these components should be similar to that of other components. You can check other components where the same rule apply in general. That means:
Allow the content (tooltip label or tooltip content) to be anything (meaning: do not assume it is just a string, but it could e.g. also be any object of type htmlgenerator.BaseElement)
Support a **kwargs parameter whose values will passed to super().__init__(). When you need to pass certain required attributes to the parent (like "_class" in most cases), then make sure to check if they already exists inside kwargs and append instead of overwriting the existing value. There is also a shortcut for that, see htmlgenerator.append_attribute.
List configuration parameters separately, with a good default value (should not be part of kwargs), e.g. def __init__(*args, orientation="left", **kwargs):
Add in
bread/layout/components/tooltip.py
Add three new components:
InteractiveTooltip
DefinitionTooltip
IconTooltip
Information about the behaviour and idea of the tooltips can be found here: https://www.carbondesignsystem.com/components/tooltip/usage/
Information about the implementation of the tooltips can be found here: https://the-carbon-components.netlify.app/?nav=tooltip
For
InteractiveTooltip
make sure to reuse an existing icon (not copying SVG code). TheIconTooltip
should support anyIcon
element.When implementing the code, please only set the minium of required attributes. For example, id-attributes or aria-attributes are not required in most casts. class and data-* attributes are almost always required.
The
__init__
methods of these components should be similar to that of other components. You can check other components where the same rule apply in general. That means:**kwargs
parameter whose values will passed tosuper().__init__()
. When you need to pass certain required attributes to the parent (like"_class"
in most cases), then make sure to check if they already exists insidekwargs
and append instead of overwriting the existing value. There is also a shortcut for that, seehtmlgenerator.append_attribute
.def __init__(*args, orientation="left", **kwargs):