Approval Gate

Inline confirmation card for AI agent actions with risk levels.

python 8 params

Preview

Usage

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


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

    def mount(self, request, **kwargs):
        self.component = ApprovalGate()

    @event_handler()
    def reject(self, value=None, **kwargs):
        pass  # your app acts on 'reject'; no component state moves

    @event_handler()
    def approve(self, value=None, **kwargs):
        pass  # your app acts on 'approve'; no component state moves
my_template.html
django
{{ component }}

Events this component sends to the view: reject, approve.

Parameters

NameTypeDefaultDescription
messagestr''Description of the action requiring approval
riskstr'medium'Risk level (low, medium, high, critical)
approve_eventstr — renames the event; identity is `name`'approve'djust event fired on approval
reject_eventstr — renames the event; identity is `name`'reject'djust event fired on rejection
approve_labelstr'Approve'Label for approve button (default: "Approve")
reject_labelstr'Reject'Label for reject button (default: "Reject")
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.approval_gateSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components-classes.cssDefines 9 of this component's classes at line 702, 704, 707, 708, 713, 714, 715, 716, 717. Override those rules, or the custom properties they read, in a stylesheet loaded after it.
cssdjust_components/components.cssDefines 1 of this component's classes at line 2524. Override those rules, or the custom properties they read, in a stylesheet loaded after it.