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):
        ...  # write to self.component; the re-render carries it
my_template.html
django
{{ component }}

Events this component sends to the view: send.

Parameters

NameTypeDefault
namestr'message'
eventstr — renames the event'send'
placeholderstr'Type a message...'
accept_filesboolFalse
accept_voiceboolFalse
file_acceptstr'*/*'
disabledboolFalse
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.multimodal_inputSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 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.
cssdjust_components/components-classes.cssDefines 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.