← All Components
<mth-role-matrix>
Interactive role-by-permission authorization matrix grid with 2D roving keyboard navigation and readonly enforcement.
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-role-matrix>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/auth/role-matrix"></script>
<mth-role-matrix></mth-role-matrix>import '@methane-ui/auth/role-matrix';
import '@methane-ui/react';
export function Example() {
return <mth-role-matrix></mth-role-matrix>;
}<script setup lang="ts">
import '@methane-ui/auth/role-matrix';
</script>
<template>
<mth-role-matrix></mth-role-matrix>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/auth/role-matrix';
import { MthRoleMatrixDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthRoleMatrixDirective],
template: `<mth-role-matrix></mth-role-matrix>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/auth/role-matrix';
import MthRoleMatrix from '@methane-ui/svelte/MthRoleMatrix.svelte';
</script>
<MthRoleMatrix></MthRoleMatrix>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
roles | — | ReadonlyArray<unknown> | — | Columns representing roles. |
permissions | — | ReadonlyArray<unknown> | — | Rows representing permissions. |
grants | — | unknown | — | Mapping of role ID to granted permission IDs. |
readonly | readonly | boolean | false | Prevents mutating role permission grants while keeping navigation intact. |
disabled | disabled | boolean | false | Disables all matrix cells. |
label | label | string | "" | Accessible label for the permissions grid. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { roleId: string; permissionId: string; granted: boolean; grants: unknown } | Emitted when a permission grant is toggled. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | Grid cell focused | Moves focus to next column cell |
| ArrowDown | both | Grid cell focused | Moves focus to cell in next row |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host". | 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-role-matrix.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(readonly), :state(disabled). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |