Inline Edit
Inline edit component for in-place text editing.
Preview
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.editingmy_template.html
django
{{ component }}Events this component sends to the view: inline_edit.
Parameters
| Name | Type | Default |
|---|---|---|
| value | str | '' |
| name | str | '' |
| event | str — renames the event | '' |
| editing | bool | False |
| edit_event | str — renames the event | 'inline_edit' |
| custom_class | str | '' |
| **kwargs | — passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.inline_edit | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 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. |