- Issue created by @musa.thomas
- 🇫🇷France pdureau Paris
It seems, this component has 3 props and no slots:
- label textfield, instead of a slot, because only plain text is allowed
- tooltip_id machine name, with random generation if empty
- placement select, with top, left, center...
This little component looks tricky to implement:
- the default state is "hidden", so using it for site-building from the front theme may be difficult
- there are 2 parts in the markup, the trigger and the tooltip. Only the tooltip belongs to the component, but it doesn't make sense to use it without the trigger.
I will not be against considering this component as out of ui_suite_dsfr scope.
- Status changed to Postponed
10 months ago 3:29am 6 February 2024 - 🇫🇷France pdureau Paris
Humble draft:
--- a/templates/patterns/button/button.ui_patterns.yml +++ b/templates/patterns/button/button.ui_patterns.yml @@ -62,6 +62,11 @@ button: left: Right right: Left preview: left + tooltip: + type: textfield + label: Tooltip + description: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/infobulle/ + preview: Lorem [...] elit ut social: type: select label: Social networks diff --git a/templates/patterns/button/pattern-button.html.twig b/templates/patterns/button/pattern-button.html.twig index 534f478..805914d 100644 --- a/templates/patterns/button/pattern-button.html.twig +++ b/templates/patterns/button/pattern-button.html.twig @@ -20,6 +20,12 @@ {% set attributes = attributes.setAttribute('disabled', true) %} {% endif %} +{% if tooltip %} + {% set tooltip_id = "tooltip-" ~ random() %} + {% set attributes = attributes.addClass('fr-btn--tooltip').setAttribute("aria-describedby", tooltip_id) %} + <span class="fr-tooltip fr-placement" id="{{ tooltip_id }}" role="tooltip" aria-hidden="true">Lorem [...] elit ut.</span> +{% endif %} + {% if url or attributes.href %} {% set url = url|default(attributes.href) %} {% if external %}
- Status changed to Active
8 months ago 3:16pm 29 March 2024 - First commit to issue fork.
- Assigned to yassrzg
- Status changed to Needs work
8 months ago 4:44pm 29 March 2024 - Merge request !65Issue #3405205: by yassrzg Missing pattern info-bulle/tooltip → (Merged) created by yassrzg
- Status changed to Needs review
8 months ago 4:55pm 29 March 2024 - Assigned to pdureau
- Issue was unassigned.
- Status changed to Fixed
8 months ago 12:56pm 7 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.