Inline Edit

Inline edit component for in-place text editing.

python 7 params

Preview

editing
Click to edit
python
inline_edit(name='title', value='Click to edit', editing=False)

Usage

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


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

    def mount(self, request, **kwargs):
        self.component = InlineEdit(name='title', value='Click to edit', editing=False)

    @event_handler()
    def inline_edit(self, **kwargs):
        self.component.editing = not self.component.editing
my_template.html
django
{{ component }}

Events this component sends to the view: inline_edit.

Parameters

NameTypeDefault
valuestr''
namestr''
eventstr — renames the event''
editingboolFalse
edit_eventstr — renames the event'inline_edit'
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.inline_editSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 2 of this component's classes at line 1551, 2441. Override those rules, or the custom properties they read, in a stylesheet loaded after it.