← All Components
<mth-key-value>
Accessible semantic <dl>/<dt>/<dd> key-value pair with horizontal/vertical layout, monospace formatting, and one-click clipboard copy.
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-key-value>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/key-value"></script>
<mth-key-value orientation="horizontal">Example</mth-key-value>import '@methane-ui/ui/key-value';
import '@methane-ui/react';
export function Example() {
return <mth-key-value orientation="horizontal">Example</mth-key-value>;
}<script setup lang="ts">
import '@methane-ui/ui/key-value';
</script>
<template>
<mth-key-value orientation="horizontal">Example</mth-key-value>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/key-value';
import { MthKeyValueDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthKeyValueDirective],
template: `<mth-key-value orientation="horizontal">Example</mth-key-value>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/key-value';
import MthKeyValue from '@methane-ui/svelte/MthKeyValue.svelte';
</script>
<MthKeyValue orientation="horizontal">Example</MthKeyValue>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | "" | Key label text when label slot is not provided. |
value | value | string | "" | Value text when default slot is not provided. |
orientation | orientation | 'horizontal' | 'vertical' | "horizontal" | Arrangement of label and value (horizontal or vertical). |
copyable | copyable | boolean | false | Displays a clipboard copy button next to the value. |
monospace | monospace | boolean | false | Renders the value in a monospace font stack. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-copy | { value: string; ok: boolean } | Emitted after attempting to copy the value to the clipboard. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | Copy button is focused | Copies value to clipboard and emits mth-copy |
both | Copy button is focused | Copies value to clipboard and emits mth-copy |
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 2 APG keyboard transitions across LTR/RTL. | mth-key-value.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(copied), :state(monospace). | Conformance suite |
| i18n | Routes 4 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |