Icon

Icon component wrapper.

python 5 params

Preview

name
size
python
icon(name='check', size='md')

Usage

views.py
python
from djust import LiveView
from djust.components import Icon


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = Icon(name='check', size='md')
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
namestr''icon name
sizestr'md'xs, sm, md, lg
icon_setstr'heroicons'icon set name (default heroicons)
custom_classstr''—
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.iconSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 4 of this component's classes at line 1305, 1307, 1308, 1309. Override those rules, or the custom properties they read, in a stylesheet loaded after it.