invalid
A component that failed validation. Rendered as a quiet "Couldn't display this component" chip with the raw payload and error available on expand.
Preview
Live preview
Usage
Inside a handler (@app.on_message, @app.on_action…), yield it or pass it to chat.send(). This is a fragment. The complete example below is a whole file you can run.
# inside a handler: @app.on_message, @app.on_action, ...yield ui.Invalid(raw='{"ui":"chart","kind":"radar"}', error="Unknown chart kind")Props
| Prop | Type | Default |
|---|---|---|
raw | string | "" |
error | string | "" |
Complete example
A whole app that shows invalid. It needs no API key.
"""A complete DyUI app that shows the `invalid` component.
Save it as app.py, then run: dyui run app.py"""import dyuifrom dyui import ui
app = dyui.App(title="Invalid demo", starters=["Show me"], persist=False)
@app.on_messageasync def reply(msg: dyui.Message, chat: dyui.Chat): yield "Here is the `invalid` component." yield ui.Invalid(raw='{"ui":"chart","kind":"radar"}', error="Unknown chart kind")- Save it as
app.pyin a new, empty folder, or download app.py. Paste it into an empty file: pasting below existing code joins the two. - Run it with
pip install dyui, thendyui run app.py. - Open http://localhost:8000 and tap Show me.