Skip to content

Commit 23c9bb5

Browse files
Fix copy button in gr.Textbox (#12516)
* fix * add changeset --------- Co-authored-by: gradio-pr-bot <[email protected]>
1 parent 4f6327b commit 23c9bb5

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

.changeset/wild-lands-shake.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gradio/textbox": patch
3+
"gradio": patch
4+
---
5+
6+
fix:Fix copy button in `gr.Textbox`

js/textbox/Index.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
placeholder={gradio.props.placeholder}
8383
submit_btn={gradio.props.submit_btn}
8484
stop_btn={gradio.props.stop_btn}
85-
show_copy_button={gradio.props.show_copy_button}
85+
buttons={gradio.props.buttons}
8686
autofocus={gradio.props.autofocus}
8787
container={gradio.shared.container}
8888
autoscroll={gradio.shared.autoscroll}

js/textbox/shared/Textbox.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
export let container = true;
2222
export let max_lines: number | undefined = undefined;
2323
export let type: "text" | "password" | "email" = "text";
24-
export let show_copy_button = false;
24+
export let buttons: string[] = [];
2525
export let submit_btn: string | boolean | null = null;
2626
export let stop_btn: string | boolean | null = null;
2727
export let rtl = false;
@@ -243,7 +243,7 @@
243243

244244
<!-- svelte-ignore a11y-autofocus -->
245245
<label class:container class:show_textbox_border>
246-
{#if show_label && show_copy_button}
246+
{#if show_label && buttons.includes("copy")}
247247
<IconButtonWrapper>
248248
<IconButton
249249
Icon={copied ? Check : Copy}

js/textbox/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface TextboxProps {
2424
placeholder: string;
2525
submit_btn: string;
2626
stop_btn: string;
27-
show_copy_button: boolean;
27+
buttons: string[];
2828
autofocus: boolean;
2929
autoscroll: boolean;
3030
max_length: number;

0 commit comments

Comments
 (0)