Skip to main content

pagination component

Project description


tags: [gradio-custom-component, SimpleTextbox, gradio pagination] title: gradio_pagination short_description: pagination component colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py

gradio_pagination

Static Badge

pagination component

Installation

pip install gradio_pagination

Usage

import gradio as gr
from gradio_pagination import pagination

total=10000
current_page = 1
page_size = 10

def show_page_info_into_text_box(data):
    global current_page, page_size
    current_page = data.page
    page_size = data.page_size
    print(data)
    return str(current_page), str(page_size)

with gr.Blocks() as demo:
    gr.Markdown("## Pagination Demo")
    pagination_component = pagination(total=total, page=1, page_size=10)
        
    with gr.Row():
        page_display = gr.Textbox(label="Current Page", value=str(current_page), interactive=False)
        size_display = gr.Textbox(label="Page Size", value=str(page_size), interactive=False)

    pagination_component.change(
        fn=show_page_info_into_text_box,
        inputs=pagination_component,
        outputs=[page_display, size_display]
    )

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

pagination

Initialization

name type default description
value
str | Callable | None
None None
placeholder
str | None
None None
label
str | None
None None
every
Timer | float | None
None None
inputs
Component | Sequence[Component] | set[Component] | None
None None
show_label
bool | None
None None
scale
int | None
None None
min_width
int
160 None
interactive
bool | None
None None
visible
bool
True None
rtl
bool
False None
elem_id
str | None
None None
elem_classes
list[str] | str | None
None None
render
bool
True None
key
int | str | None
None None
total
int | None
0 None
page
int | None
1 None
page_size
int | None
10 None

Events

name description
change Triggered when the value of the pagination 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.

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, str | None: Returns a namespace object representing the pagination state.
def predict(
    value: str | None
) -> str | None:
    return value

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gradio_pagination-0.0.1.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

gradio_pagination-0.0.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file gradio_pagination-0.0.1.tar.gz.

File metadata

  • Download URL: gradio_pagination-0.0.1.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for gradio_pagination-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a682846df788903c7e43d6919130526efdb1e2f4896aa01c0aca9d00a38e40b2
MD5 8924f2b0469225c04c0779bd67a70a1a
BLAKE2b-256 6e10544d45bd78958be094f4691a474b30d2f515284372bc8fc7c1e50132a480

See more details on using hashes here.

File details

Details for the file gradio_pagination-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gradio_pagination-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e88877723b3c304db490b02079349231fd47412b03929d5b6c93d628a0e19ff
MD5 2c843d71b01b324e2fcabb1311d9bfff
BLAKE2b-256 4c1a5de45b4326dc508ff3738733178d7e88844ce2fcab056d5c4a930e197253

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page