Hover Card
A preview card that opens when the pointer rests on a link or name, and on keyboard focus.
Rendering Hover Card…
Installation
Copy the source into your project with the CLI. It lands under @/components/ui and is yours to edit.
npx mlola-ui add hover-cardUsage
import { HoverCard } from "@/components/ui/hover-card";
export default function Example() {
return (
<HoverCard content={<p>Lena Park, design lead. Owns the pricing page.</p>}>
<a href="/people/lena">@lena</a>
</HoverCard>
);
}Styling comes from the engine stylesheet and the nearest theme. Set it once at the root:
<html data-theme="graphite" data-mode="light">HTML
The markup the example above renders, at rest. The interaction lives in the React component; from another framework, set the attributes below as the state changes.
<a href="/people/lena">@lena</a>Options
| Prop | Values | Default |
|---|---|---|
align | startcenterend | start |
side | topbottomleftright | bottom |
Every prop with a fixed set of values, read from the exported TypeScript types with its doc comment. Open the Code tab above for the rest of the API.
Classes and attributes
A class names each element; data-* and aria-* attributes carry its variant and state. The values listed are the ones the stylesheet draws; the default needs no attribute.
| Class | Attributes |
|---|---|
ml-hover-card | — |
Accessibility and theming
- Semantic elements, accessible names and state relationships are part of the contract.
- Keyboard, pointer and touch paths are operable; focus stays visible in every theme.
- Light and dark modes pass WCAG AA contrast in all 5 canonical themes.
- Reduced motion and forced colors keep meaning and operation.
Dependencies
Installed alongside this component. No third-party UI runtime is ever added.
@mlola-ui/behavior