Skip to main content
brickwork
GitHub Log in Get started
Display
Theme
Density
Direction
Brand

Documentation

Comparison table

A semantic feature-comparison table with responsive stacked rows.

All components Component Brickwork 4.3.1

Try it

Plan comparison

Open full-page preview

A highlighted Pro plan.

Plans

Plan comparison
Capability Starter Pro (Recommended)
Projects 3 Unlimited
Support Not included Included
Use to compare plans, products, or alternatives where each row answers one criterion.

Use it

Working invocation

This code creates the configuration shown above. Copy the template and the required Python context together.

templates/your_app/component.html

Django template

{% include "brickwork/components/_comparison_table.html" with heading=heading caption=caption plans=plans rows=rows highlighted="Pro" %}

your_app/views.py

Python

context = {'plans': ['Starter', 'Pro'], 'rows': [{'label': 'Projects', 'cells': ['3', 'Unlimited']}, {'label': 'Support', 'cells': [{'included': False}, {'included': True}]}], 'heading': 'Plans', 'caption': 'Plan comparison'}

Guide

Add it to your project

  1. Prepare heading labels and comparison rows.
  2. Include the partial with the table context.
  3. Keep values as text or safe, consumer-owned markup only when appropriate.

View this component's source for the installed release

Options

Public API

Option Type Default Required Description
heading str Not set No Section heading. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
lede str Not set No Introductory copy. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
note str Not set No Supporting note. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
caption str Not set No Semantic table caption. Constraint: Describe the specimen when a visible figure caption adds context.
heading_id str bw-comparison-table-heading No Stable heading id; change for multiple comparisons. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
plans list[str] Not set No Plan headers after the capability column. Constraint: Each plan record needs a stable identifier and label; every comparison row must align to that order.
rows list[dict] Not set No Rows with `label` and `cells`; a cell is text or `{included: bool}`. Constraint: Use records in the documented column order; preserve a cell for every declared column.
highlighted int|str Not set No Zero-based plan index, digit string, or exact plan name. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.
highlighted_label str Recommended No Visually hidden recommendation text for the highlighted header. Constraint: No additional package-level validation is documented beyond this option's stated type and its role in the component.

Behaviour

Accessibility and responsive behaviour

Accessibility
Uses table semantics and preserves labels with each stacked value.
Responsive
`scroll` preserves the table; `stack` exposes each cell with its row label.
Without JavaScript
Static table HTML only.

Need help?

Troubleshooting

Contract check: An empty plans or rows list renders the intro alone (or nothing if that

Do not expect a fabricated comparison table for empty data; provide plans and rows together when a comparison is available.

Documentation