Feedback Widget
Thumbs up/down, star rating, or emoji feedback widget.
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 = valuemy_template.html
django
{{ component }}Events this component sends to the view: rate_response.
Parameters
| Name | Type | Default |
|---|---|---|
| event | str — renames the event; identity is `name` | 'rate_response' |
| mode | str | 'thumbs' |
| value | str | None | None |
| 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.feedback_widget | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |
| css | djust_components/components-classes.css | Defines 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. |