← All Components
<mth-lottie>
Accessible DotLottie animation player wrapping @lottiefiles/dotlottie-web with reduced-motion support.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-lottie>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/media/lottie"></script>
<mth-lottie loop speed="1"></mth-lottie>import '@methane-ui/media/lottie';
import '@methane-ui/react';
export function Example() {
return <mth-lottie loop speed="1"></mth-lottie>;
}<script setup lang="ts">
import '@methane-ui/media/lottie';
</script>
<template>
<mth-lottie loop speed="1"></mth-lottie>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/media/lottie';
import { MthLottieDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthLottieDirective],
template: `<mth-lottie loop speed="1"></mth-lottie>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/media/lottie';
import MthLottie from '@methane-ui/svelte/MthLottie.svelte';
</script>
<MthLottie loop speed="1"></MthLottie>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
src | src | string | "" | Animation asset URL validated against the safe URL allowlist. |
autoplay | autoplay | boolean | false | Starts animation automatically unless prefers-reduced-motion is active. |
loop | loop | boolean | true | Repeats the animation continuously. |
speed | speed | number | 1 | Playback speed multiplier (> 0). |
playing | playing | boolean | false | Whether playback is active. |
controls | controls | boolean | true | Displays built-in play/pause and stop controls. |
disabled | disabled | boolean | false | Disables playback controls. |
label | label | string | "" | Accessible region label. |
animationData | — | unknown | undefined | — | Inline Lottie JSON/buffer payload passed to DotLottie. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-play | { speed: number; loop: boolean } | Fired when animation playback starts. |
mth-pause | { speed: number } | Fired when animation playback pauses. |
mth-stop | void | Fired when animation playback stops. |
mth-error | { reason: string } | Fired when an invalid source URL is blocked. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Focus is on the play/pause button | Toggles animation playback unless prefers-reduced-motion is active |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | 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-lottie.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(playing), :state(frozen), :state(disabled). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |