← All Components
<mth-barcode>
Zero-dependency deterministic ISO/IEC 15417 Code 128B SVG barcode generator with accessible label and optional caption.
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-barcode>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/barcode"></script>
<mth-barcode height="56" show-value></mth-barcode>import '@methane-ui/ui/barcode';
import '@methane-ui/react';
export function Example() {
return <mth-barcode height="56" show-value></mth-barcode>;
}<script setup lang="ts">
import '@methane-ui/ui/barcode';
</script>
<template>
<mth-barcode height="56" show-value></mth-barcode>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/barcode';
import { MthBarcodeDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthBarcodeDirective],
template: `<mth-barcode height="56" show-value></mth-barcode>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/barcode';
import MthBarcode from '@methane-ui/svelte/MthBarcode.svelte';
</script>
<MthBarcode height="56" show-value></MthBarcode>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | ASCII text encoded as Code 128B bars. |
label | label | string | "" | Accessible alternative text describing the barcode. |
height | height | number | 56 | Bar block height in SVG user units/CSS pixels. |
showValue | show-value | boolean | true | Displays the human-readable encoded string beneath the bars. |
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 |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |