Comparison Table

Feature comparison table for SaaS plans / product tiers.

python 5 params

Preview

Free
$0
Pro
$20
Team
$60
Projects1UnlimitedUnlimited
SupportCommunityEmailPriority
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

NameTypeDefaultDescription
planslist | NoneNoneList of dicts with ``name``, optional ``price``, ``highlighted``
featureslist | NoneNoneList of dicts with ``name`` and ``values`` (list matching plans order). Boolean values render as check/cross marks.
eventstr — renames the event; identity is `name`''djust click event for plan selection
custom_classstr''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
FilePathNotes
moduledjust.components.components.comparison_tableSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.