gradio/ui/packages/app/src/components/Checkbox/Checkbox.svelte

31 lines
779 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 } from "@gradio/atoms";
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
2022-03-12 00:00:48 +08:00
export let value: boolean = false;
2022-03-29 21:10:35 +08:00
export let default_value: boolean = false;
export let style: string = "";
export let label: string = "Checkbox";
2022-03-12 00:00:48 +08:00
export let mode: "static" | "dynamic";
export let form_position: "first" | "last" | "mid" | "single" = "single";
export let show_label: boolean;
export let loading_status: "complete" | "pending" | "error";
2022-03-29 21:10:35 +08:00
if (default_value) value = default_value;
</script>
<Block {form_position}>
<StatusTracker tracked_status={loading_status} />
<Checkbox
{style}
{label}
{show_label}
bind:value
on:change
disabled={mode === "static"}
/>
</Block>