Multimodal Input
Text area with optional file attachment and voice input buttons.
Preview
Arguments
multimodal_input(name='prompt', placeholder='Ask anything…')
Usage
views.py
python
from djust import LiveView
from djust.decorators import event_handler
from djust.components import MultimodalInput
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = MultimodalInput(name='prompt', placeholder='Ask anything…')
@event_handler()
def send(self, value=None, **kwargs):
... # write to self.component; the re-render carries itmy_template.html
django
{{ component }}Events this component sends to the view: send.
Parameters
| Name | Type | Default |
|---|---|---|
| name | str | 'message' |
| event | str — renames the event | 'send' |
| placeholder | str | 'Type a message...' |
| accept_files | bool | False |
| accept_voice | bool | False |
| file_accept | str | '*/*' |
| disabled | bool | False |
| 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.multimodal_input | 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 1667, 1669, 1671, 1673. 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 689, 691, 692. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |