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):
pass # your app acts on 'send'; no component state movesmy_template.html
django
{{ component }}Events this component sends to the view: send.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| name | str | 'message' | Form field name for the text input |
| event | str — renames the event | 'send' | djust event fired on send |
| placeholder | str | 'Type a message...' | Placeholder text for the textarea |
| accept_files | bool | False | Whether to show file attachment button |
| accept_voice | bool | False | Whether to show voice input button |
| file_accept | str | '*/*' | MIME types for file input (default: "*/*") |
| disabled | bool | False | Whether the input is disabled |
| custom_class | str | '' | Additional CSS classes |
| **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 1693, 1695, 1697, 1699. 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 691, 693, 694. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |