Interactive directives provide JavaScript-enhanced components for code examples and data tables.
Key Terms
- Code Tabs
- An interactive tabbed interface (
{code-tabs}) for displaying code examples in multiple languages. Users can switch between languages with tab navigation. - Data Table
- An interactive table directive (
{data-table}) with JavaScript-enhanced features like sorting, filtering, and pagination. Requires Tabulator.js in your theme.
Code Tabs
Create tabbed interfaces for multi-language code examples.
Syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Note: You can also use### Language Name(without "Tab:" prefix).
Alias:{code_tabs}(underscore variant)
Examples
Python and JavaScript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Multiple Languages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
Rendering
Code tabs render as interactive tabbed interface with:
- Tab navigation for switching languages
- Syntax highlighting for each language
- First tab selected by default
Data Table
Create interactive data tables with sorting, filtering, and pagination (requires Tabulator.js).
Syntax:
1 2 3 4 5 6 7 8 9 10 | |
Options:
:columns:- Comma-separated column identifiers:headers:- Comma-separated header labels:sortable:- Enable sorting:true,false(default:true):filterable:- Enable filtering:true,false(default:true):pagination:- Enable pagination:true,false(default:true)
Examples
Basic Data Table:
1 2 3 4 5 6 7 8 | |
With Options:
1 2 3 4 5 6 7 8 9 10 11 | |
Rendering
Data tables render as interactive tables with:
- Column sorting (click headers)
- Search/filter functionality
- Pagination (if enabled)
- Responsive design
Note: Requires Tabulator.js to be included in your theme.
Best Practices
- Code Tabs: Use for comparing code across languages or showing multiple approaches
- Data Tables: Use for large datasets that benefit from sorting/filtering
- Performance: Consider pagination for very large tables
- Accessibility: Ensure JavaScript is enabled for interactive features
Related
- Layout Directives - Static tabs and cards
- Formatting Directives - List tables (static)