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

32 lines
796 B
Svelte
Raw Normal View History

<script lang="ts">
2022-03-08 21:35:42 +08:00
import { Radio } from "@gradio/form";
import { Block } from "@gradio/atoms";
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
2022-03-08 21:35:42 +08:00
export let label: string = "Radio";
2022-03-12 00:00:48 +08:00
export let value: string = "";
2022-03-29 21:10:35 +08:00
export let default_value: string;
export let style: string = "";
2022-03-12 00:00:48 +08:00
export let choices: Array<string> = [];
export let mode: "static" | "dynamic";
export let form_position: "first" | "last" | "mid" | "single" = "single";
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} type="fieldset">
<StatusTracker tracked_status={loading_status} />
<Radio
{form_position}
bind:value
{label}
{style}
{choices}
disabled={mode === "static"}
on:change
/>
</Block>