Buckets:

download
raw
2.62 kB
from __future__ import annotations
from typing import Literal
from gradio_client.documentation import document
from gradio.blocks import BlockContext
from gradio.component_meta import ComponentMeta
@document()
class Draggable(BlockContext, metaclass=ComponentMeta):
"""
Draggable is a layout element within Blocks that renders children with drag and drop functionality.
A user can reorder children by dragging them around and snapping them into place. If a child is a
layout (e.g. gr.Row, gr.Group), all the components in the child layout will drag together.
Demos: draggable_dashboard
"""
EVENTS = []
def __init__(
self,
*,
orientation: Literal["row", "column"] = "column",
visible: bool | Literal["hidden"] = True,
elem_id: str | None = None,
elem_classes: list[str] | str | None = None,
render: bool = True,
key: int | str | tuple[int | str, ...] | None = None,
preserved_by_key: list[str] | str | None = None,
):
"""
Parameters:
orientation: The direction in which children are arranged. 'row' arranges children horizontally, 'column' arranges them vertically.
visible: If False, draggable container will be hidden.
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
key: in a gr.render, Components with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render.
preserved_by_key: A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor.
"""
self.orientation = orientation
super().__init__(
visible=visible,
elem_id=elem_id,
elem_classes=elem_classes,
render=render,
key=key,
preserved_by_key=preserved_by_key,
)

Xet Storage Details

Size:
2.62 kB
·
Xet hash:
1922a9b75e8a37171ee095e8384b328d07719d4d03962383a7153cdb5911762e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.