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

NameTypeDefault
planslist | NoneNone
featureslist | NoneNone
eventstr — renames the event; identity is `name`''
custom_classstr''
**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 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.