← All Components
<mth-presence-badge>
Accessible user presence indicator with shape-differentiated SVG markers for forced-colors safety.
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-presence-badge>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/chat/presence-badge"></script>
<mth-presence-badge status="online" show-label>Example</mth-presence-badge>import '@methane-ui/chat/presence-badge';
import '@methane-ui/react';
export function Example() {
return <mth-presence-badge status="online" show-label>Example</mth-presence-badge>;
}<script setup lang="ts">
import '@methane-ui/chat/presence-badge';
</script>
<template>
<mth-presence-badge status="online" show-label>Example</mth-presence-badge>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/chat/presence-badge';
import { MthPresenceBadgeDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthPresenceBadgeDirective],
template: `<mth-presence-badge status="online" show-label>Example</mth-presence-badge>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/chat/presence-badge';
import MthPresenceBadge from '@methane-ui/svelte/MthPresenceBadge.svelte';
</script>
<MthPresenceBadge status="online" show-label>Example</MthPresenceBadge>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
status | status | 'online' | 'away' | 'busy' | 'offline' | "offline" | Presence availability state (online, away, busy, or offline). |
label | label | string | "" | Optional accessible/visible status override text. |
showLabel | show-label | boolean | true | Displays the localized status label beside the indicator. |
size | size | 'sm' | 'md' | "md" | Badge sizing token (sm or md). |
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 |
| states | Exposes ElementInternals CustomStateSet flags: :state(online), :state(away), :state(busy), :state(offline). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |