Skip to content

Commit

Permalink
Add icon and link to DuplicateButton (#5111)
Browse files Browse the repository at this point in the history
* fix icon/link in duplicatebutton

* add changeset

* add changeset

* add icon/link to duplicate

* add changeset

* jsons

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
aliabd and gradio-pr-bot committed Aug 7, 2023
1 parent 2f3b57a commit b84a35b
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 19,631 deletions.
6 changes: 6 additions & 0 deletions .changeset/wise-cooks-itch.md
@@ -0,0 +1,6 @@
---
"gradio": patch
"website": patch
---

fix:Add icon and link to DuplicateButton
18 changes: 18 additions & 0 deletions gradio/components/duplicate_button.py
Expand Up @@ -28,6 +28,8 @@ def __init__(
value: str = "Duplicate Space",
variant: Literal["primary", "secondary", "stop"] = "secondary",
size: Literal["sm", "lg"] | None = "sm",
icon: str | None = None,
link: str | None = None,
visible: bool = True,
interactive: bool = True,
elem_id: str | None = None,
Expand All @@ -37,10 +39,26 @@ def __init__(
_activate: bool = True,
**kwargs,
):
"""
Parameters:
value: Default text for the button to display. If callable, the function will be called whenever the app loads to set the initial value of the component.
variant: 'primary' for main call-to-action, 'secondary' for a more subdued style, 'stop' for a stop button.
size: Size of the button. Can be "sm" or "lg".
icon: URL or path to the icon file to display within the button. If None, no icon will be displayed.
link: URL to open when the button is clicked. If None, no link will be used.
visible: If False, component will be hidden.
interactive: If False, the Button will be in a disabled state.
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 list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
"""
super().__init__(
value,
variant=variant,
size=size,
icon=icon,
link=link,
visible=visible,
interactive=interactive,
elem_id=elem_id,
Expand Down
4 changes: 1 addition & 3 deletions js/_website/src/routes/changelog/changelog.json

Large diffs are not rendered by default.

173 changes: 1 addition & 172 deletions js/_website/src/routes/demos/demos.json

Large diffs are not rendered by default.

19,454 changes: 1 addition & 19,453 deletions js/_website/src/routes/docs/docs.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/_website/src/routes/guides/json/guides_by_category.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/_website/src/routes/version.json
@@ -1 +1 @@
{ "version": "3.39.0" }
{"version": "3.39.0"}

1 comment on commit b84a35b

@vercel
Copy link

@vercel vercel bot commented on b84a35b Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.