Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

gradio_banner

PyPI Demo Static Badge

A banner component for displaying important information, alerts, notifications, and types of messages within a Gradio Blocks.

Installation

pip install gradio_banner

Usage

import gradio as gr
from gradio_banner import Banner

with gr.Blocks() as demo:
    with gr.Row():
        Banner(value="Large info banner *with* **markdown** `value`", variant="info")
    with gr.Row():
        Banner(variant="success", size="sm")
    with gr.Row():
        Banner(value="Large warning banner with default label and specified value", variant="warning")
    with gr.Row():
        Banner(variant="error", show_close_button=True)
    with gr.Row():
        with gr.Column():
            with gr.Row():
                Banner(value="Small info banner with close button and without label", size="sm", show_close_button=True, show_label=False)
            with gr.Row():
                Banner(label="Custom label and icon", value="Large info banner with custom icon", icon="https://i.pinimg.com/originals/e9/ab/30/e9ab30fdcadf40bdc095a1e317f3851c.gif")
        with gr.Column():
            Banner(value="Large success banner with specified value", variant="success")

if __name__ == "__main__":
    demo.launch()

Initialization

name type default description
value
str | Callable | None
None
variant
str
"info"
label
str | None
None
icon
str | None
None
size
Literal["sm", "lg"] | None
"lg"
show_close_button
bool
False
show_icon
bool
True
every
Timer | float | None
None
inputs
Component | list[Component] | set[Component] | None
None
show_label
bool | None
None
scale
int | None
None
min_width
int
160
visible
bool
True
rtl
bool
False
elem_id
str | None
None
elem_classes
list[str] | str | None
None
render
bool
True
key
int | str | None
None

Events

name description
change Triggered when the value of the Banner changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See .input() for a listener that is only triggered by user input.
input This listener is triggered when the user changes the value of the Banner.
submit This listener is triggered when the user presses the Enter key while the Banner is focused.

User function

The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).

  • When used as an Input, the component only impacts the input signature of the user function.
  • When used as an output, the component only impacts the return signature of the user function.

The code snippet below is accurate in cases where the component is used as both an input and an output.

  • As output: Is passed, passes text value as a {str} into the function.
  • As input: Should return, expects a {str} returned from function and sets textarea value to it.
def predict(
    value: str | None
) -> str | None:
    return value

Metadata

Release files for gradio-banner 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for gradio-banner 1.0.1
File Interpreter ABI Platform
gradio_banner-1.0.1-py3-none-any.whl Python 3 none any Details

Release files / gradio_banner-1.0.1-py3-none-any.whl

Download URL gradio_banner-1.0.1-py3-none-any.whl
Size 82.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93d4939648557bc19f06c93fca96f4fce1edb735af8adb9f136c588b5cfec772
BLAKE2b-256 checksum
How to use checksums
b3ad7f7e348c0cfe49e45f8841eca17b43ebec43bcd7ea07d13281e1daf5ce70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page