gradio/js/tabs/Index.svelte
Hannah 61cd768490
Ensures tabs with visible set to false are not visible. (#9653)
* * fix tab visibility
* add story

* add changeset

* stuff

* fix

* more fix

* fix undefined tab labels

* fix tabs again

* add changeset

* format

* format

* fix type

* add changeset

* fix all things

* format

* add changeset

* notebooks

* visible tabs

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
2024-10-21 16:46:01 -07:00

38 lines
874 B
Svelte

<script context="module" lang="ts">
export { default as BaseTabs, TABS, type Tab } from "./shared/Tabs.svelte";
</script>
<script lang="ts">
import type { Gradio, SelectData } from "@gradio/utils";
import { createEventDispatcher } from "svelte";
import Tabs, { type Tab } from "./shared/Tabs.svelte";
const dispatch = createEventDispatcher();
export let visible = true;
export let elem_id = "";
export let elem_classes: string[] = [];
export let selected: number | string;
export let initial_tabs: Tab[] = [];
export let gradio:
| Gradio<{
change: never;
select: SelectData;
}>
| undefined;
$: dispatch("prop_change", { selected });
</script>
<Tabs
{visible}
{elem_id}
{elem_classes}
bind:selected
on:change={() => gradio?.dispatch("change")}
on:select={(e) => gradio?.dispatch("select", e.detail)}
{initial_tabs}
>
<slot />
</Tabs>