alto/commonmark-tabs

CommonMark extension that renders accessible tabbed content from @tabs / @tab / @endtabs markers with full ARIA support.

Maintainers

Package info

github.com/altophp/commonmark-tabs

Homepage

Issues

Documentation

pkg:composer/alto/commonmark-tabs

Transparency log

Fund package maintenance!

smnandre

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-07-30 02:00 UTC

This package is auto-updated.

Last update: 2026-07-30 02:57:04 UTC


README

Summary

One directive, fully accessible tabbed UI, zero JavaScript to write. @tabs / @tab / @endtabs markers are parsed into proper ARIA tablist, tab, and tabpanel roles with a self-contained switching script included. The cleanest path from markdown syntax to an interactive UI component in the PHP CommonMark ecosystem.

Installation

composer require

composer require alto/commonmark

Registration

use Alto\CommonMark\Extension\Tabs\TabsExtension;
use League\CommonMark\Environment\Environment;

$environment = new Environment();
$environment->addExtension(new TabsExtension());

Usage

@tabs
@tab "PHP"
```php
<?php echo 'Hello';
```

@tab "JavaScript"
```js
console.log('Hello');
```
@endtabs

Configuration

  • Constructor accepts keys: container_class, tabs_class, tab_class, panel_class, active_class, generate_ids.
  • Default output includes ARIA roles (tablist, tab, tabpanel).

Minimal Example

@tabs
@tab "Overview"
Project overview.
@tab "Install"
composer require vendor/package
@endtabs

Development

This extension is actively developed in the alto/commonmark monorepo.

License

MIT License -- Simon André & Alto