gradio/js/app/src/components/Checkbox/Checkbox.svelte

38 lines
951 B
Svelte
Raw Normal View History

2022-02-02 22:02:09 +08:00
<script lang="ts">
2022-03-08 21:35:42 +08:00
import { Checkbox } from "@gradio/form";
import { Block, Info } from "@gradio/atoms";
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
import type { LoadingStatus } from "../StatusTracker/types";
import type { Styles } from "@gradio/utils";
2022-03-12 00:00:48 +08:00
export let elem_id: string = "";
export let elem_classes: Array<string> = [];
export let visible: boolean = true;
2022-03-12 00:00:48 +08:00
export let value: boolean = false;
export let label: string = "Checkbox";
export let info: string | undefined = undefined;
2022-03-12 00:00:48 +08:00
export let mode: "static" | "dynamic";
export let style: Styles = {};
export let loading_status: LoadingStatus;
</script>
<Block
{visible}
{elem_id}
{elem_classes}
disable={typeof style.container === "boolean" && !style.container}
>
<StatusTracker {...loading_status} />
{#if info}
<Info>{info}</Info>
{/if}
<Checkbox
{label}
bind:value
on:change
on:select
disabled={mode === "static"}
/>
</Block>