A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Tooltip#

Component <neo-tooltip> is a hover/focus tooltip on the same positioning primitives as <neo-popover> with tooltip semantics: no focus stealing, no click dismissal, pointer-events: none, role="tooltip", and aria-describedby on the trigger. The first non-content child is the trigger. The text attribute is the shorthand body; pass a child carrying [data-neo-tooltip-content] instead to render rich markup.

Not visible on touch

Tooltips trigger on hover and keyboard focus; touch devices have neither, so a tap never reveals one. Never put essential information only in a tooltip; keep it available inline for touch and assistive technology users.

Default
Placements
Shorthand body
Rich content
Delays
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
Hover me
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
textstring observednonePlain-text body. Ignored when [data-neo-tooltip-content] is present.
placementstring observed"bottom-start"Same values as <neo-popover>; see its placement values.
hover-open-delaynumber350Hover dwell in ms before showing. Focus shows immediately.
hover-close-delaynumber0Linger in ms after pointer leaves.
openboolean reflected observedfalseControls tooltip visibility.

Slots #

NameDescription
defaultTrigger element.
[data-neo-tooltip-content]Rich body. Overrides the text attribute.

CSS variables #

NameDefaultDescription
--neo-tooltip-bgcolor-mix(in srgb, var(--page-fg) 92%, transparent)Tooltip background.
--neo-tooltip-colorvar(--page-bg)Tooltip text color.
--neo-tooltip-radiusvar(--page-radius, 0.25rem)Corner radius.
--neo-tooltip-paddingcalc(var(--page-spacing, 0.25rem) * 1.25) calc(var(--page-spacing, 0.25rem) * 2.25)Inner padding.
--neo-tooltip-font-size0.8remBody font size.
--neo-tooltip-max-width18remMaximum width before the body wraps.
--neo-tooltip-shadow0 4px 12px -2px rgba(0, 0, 0, 0.25)Box shadow.
--neo-tooltip-z-index1100Stacking order of the floating body.
--neo-tooltip-enter-durationcalc(120ms * var(--neo-duration-scale, 1))Enter and exit transition duration.
--neo-tooltip-screen-offset8pxMinimum margin between the body and the viewport edge.

Examples#

Placements#

Twelve combinations: each side (top, right, bottom, left) paired with optional -start or -end alignment. Bare side names center the panel on that edge; bottom-start is the initial value.

top-starttoptop-endright-startrightright-endbottom-startbottombottom-endleft-startleftleft-end

Shorthand body#

Pass text and skip the slot entirely. Common for icon-only triggers where the tooltip names the action a glyph represents.

Rich content#

Drop a child carrying [data-neo-tooltip-content] to render arbitrary markup as the body. The text attribute is ignored once that slot is present, so the slot wins on collisions.

Hover me (rich) Heads up: this action notifies everyone in the channel.@evelyn
Evelyn Kone
Data Analyst

Delays#

hover-open-delay is the hover dwell (ms) the host waits before showing the tooltip; hover-close-delay is how long it lingers after the pointer leaves. Defaults are 350 and 0. Focus shows the tooltip immediately; the delays are hover-only.

hover-open-delay 0default 350mshover-open-delay 1000hover-close-delay 600

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator