Skip to content
Focsd homeFocsd homeFocsd
Forms

Toggletip

An info button that opens a short note on click, tap or Enter. The note can hold links.

  • Tag: focsd-toggletip
  • Pattern: Button + non-modal popover, announced politely
  • Category: Overlays

Example

Storage used Includes files in the trash. See billing

Retention Deleted items are kept for 30 days.

HTML
<p>
Storage used
<focsd-toggletip
>Includes files in the trash. <a href="#billing">See billing</a></focsd-toggletip
>
</p>
<p>
Retention
<focsd-toggletip label="About retention" placement="bottom"
>Deleted items are kept for 30 days.</focsd-toggletip
>
</p>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-toggletip.js';
</script>
<focsd-toggletip>…</focsd-toggletip>

API

Attributes

AttributePropertyTypeDefault
labellabelstring—
placementplacement'top' | 'bottom' | 'left' | 'right'top

Events

EventDescription
closeFired when the toggletip closes.

Slots

SlotDescription
(default)The information shown in the popover.

CSS parts

Style the inside of the component with ::part(), for example focsd-toggletip::part(button).

PartDescription
buttonThe info button.
panelThe popover holding the content.
statusThe visually hidden status region that announces the content.

Accessibility

  • Unlike focsd-tooltip, a toggletip opens on click, so it works on touch screens, and its note may hold links: they follow the button in Tab order.
  • The button is named "More information" unless you set label; name it after what it explains when a page has several. It reports aria-expanded and is at least 24 by 24 pixels.
  • Opening it leaves focus on the button and copies the note’s text into a polite status region, so a screen reader reads it without moving there.
  • Escape, clicking the button again or clicking anywhere else closes it. If focus was on a link inside, it returns to the button.
  • The element fires focsd-open when the note opens and close when it closes.

Keyboard

KeyAction
Enter / SpaceOpen or close the note
TabMove to a link inside the open note
EscapeClose the note; focus stays on the button