← All Components
<mth-hover-card>
Rich preview card anchored to a trigger with progressive interestfor enhancement, hover/focus timers, and dual-path CSS Anchor / JS positioning.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
@methane-ui/ui@0.1.0
167 accessible Web Components with OKLCH tokens and SSR hydration.
Ready · interact with <mth-hover-card>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/hover-card"></script>
<mth-hover-card placement="top" open-delay="200">Example</mth-hover-card>import '@methane-ui/ui/hover-card';
import '@methane-ui/react';
export function Example() {
return <mth-hover-card placement="top" open-delay="200">Example</mth-hover-card>;
}<script setup lang="ts">
import '@methane-ui/ui/hover-card';
</script>
<template>
<mth-hover-card placement="top" open-delay="200">Example</mth-hover-card>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/hover-card';
import { MthHoverCardDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthHoverCardDirective],
template: `<mth-hover-card placement="top" open-delay="200">Example</mth-hover-card>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/hover-card';
import MthHoverCard from '@methane-ui/svelte/MthHoverCard.svelte';
</script>
<MthHoverCard placement="top" open-delay="200">Example</MthHoverCard>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | false | Whether the hover card popup is open. |
placement | placement | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end' | "bottom" | Preferred floating placement relative to the trigger. |
openDelay | open-delay | number | 200 | Delay in milliseconds before opening on hover or focus. |
closeDelay | close-delay | number | 300 | Delay in milliseconds before closing after pointer or focus leaves. |
disabled | disabled | boolean | false | Prevents the hover card from opening interactively. |
forceFallback | force-fallback | boolean | false | Forces JavaScript fallback positioning instead of CSS Anchor Positioning. |
label | label | string | "" | Accessible label applied to the floating hover card dialog surface. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-open | undefined | Cancelable event dispatched before the hover card opens. |
mth-after-open | undefined | Dispatched after the hover card opens. |
mth-close | undefined | Cancelable event dispatched before the hover card closes. |
mth-after-close | undefined | Dispatched after the hover card closes. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Escape | both | open | Closes the open hover card and restores focus to trigger. |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 1 APG keyboard transitions across LTR/RTL. | mth-hover-card.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open). | Conformance suite |
| i18n | Routes 1 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |