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 |
|---|---|---|
| plans | list | None | None |
| features | list | None | None |
| event | str — renames the event; identity is `name` | '' |
| custom_class | str | '' |
| **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 2212, 2213, 2214, 2215, 2216, 2217, 2218, 2219, 2220, 2221. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |