Multimodal Input

Text area with optional file attachment and voice input buttons.

python 9 params

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 moves
my_template.html
django
{{ component }}

Events this component sends to the view: send.

Parameters

NameTypeDefaultDescription
namestr'message'Form field name for the text input
eventstr — renames the event'send'djust event fired on send
placeholderstr'Type a message...'Placeholder text for the textarea
accept_filesboolFalseWhether to show file attachment button
accept_voiceboolFalseWhether to show voice input button
file_acceptstr'*/*'MIME types for file input (default: "*/*")
disabledboolFalseWhether the input is disabled
custom_classstr''Additional CSS classes
**kwargs— passed to `Component.__init__`: `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.multimodal_inputSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.
cssdjust_components/components-classes.cssDefines 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.