Feedback Widget

Thumbs up/down, star rating, or emoji feedback widget.

python 5 params

Preview

Arguments
feedback_widget(mode='thumbs', value='up')

Usage

views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import FeedbackWidget


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

    def mount(self, request, **kwargs):
        self.component = FeedbackWidget(mode='thumbs', value='up')

    @event_handler()
    def rate_response(self, value, **kwargs):
        self.component.value = value
my_template.html
django
{{ component }}

Events this component sends to the view: rate_response.

Parameters

NameTypeDefault
eventstr — renames the event; identity is `name`'rate_response'
modestr'thumbs'
valuestr | NoneNone
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.feedback_widgetSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 4 of this component's classes at line 1678, 1679, 1681, 2428. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_components/components-classes.cssDefines 3 of this component's classes at line 695, 696, 697. Override those rules, or the custom properties they read, in a stylesheet loaded after it.