Comparison Table
Feature comparison table for SaaS plans / product tiers.
Preview
Free $0 | Pro $20 | Team $60 | |
|---|---|---|---|
| Projects | 1 | Unlimited | Unlimited |
| Support | Community | Priority |
Arguments
comparison_table(plans=[{'name': 'Free', 'price': '$0'}, {'name': 'Pro', 'price': '$20', 'highlighted': True}, {'name': 'Team', 'price': '$60'}], features=[{'name': 'Projects', 'values': ['1', 'Unlimited', 'Unlimited']}, {'name': 'Support', 'values': ['Community', 'Email', 'Priority']}])Usage
views.py
python
from djust import LiveView
from djust.components import ComparisonTable
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = ComparisonTable(plans=[{'name': 'Free', 'price': '$0'}, {'name': 'Pro', 'price': '$20', 'highlighted': True}, {'name': 'Team', 'price': '$60'}], features=[{'name': 'Projects', 'values': ['1', 'Unlimited', 'Unlimited']}, {'name': 'Support', 'values': ['Community', 'Email', 'Priority']}])my_template.html
django
{{ component }}Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| plans | list | None | None | List of dicts with ``name``, optional ``price``, ``highlighted`` |
| features | list | None | None | List of dicts with ``name`` and ``values`` (list matching plans order). Boolean values render as check/cross marks. |
| event | str — renames the event; identity is `name` | '' | djust click event for plan selection |
| custom_class | str | '' | Additional CSS classes |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.comparison_table | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 10 of this component's classes at line 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |