2022-03-03 00:42:43 +08:00
|
|
|
<script lang="ts">
|
|
|
|
import { createEventDispatcher } from "svelte";
|
2022-04-06 01:11:29 +08:00
|
|
|
import { Block, BlockTitle } from "@gradio/atoms";
|
|
|
|
|
2022-03-03 00:42:43 +08:00
|
|
|
export let label: string;
|
|
|
|
export let value: string | undefined = undefined;
|
|
|
|
export let choices: Array<string>;
|
2022-04-09 02:46:00 +08:00
|
|
|
export let style: string = "";
|
2022-04-08 03:36:49 +08:00
|
|
|
export let disabled: boolean = false;
|
2022-04-22 17:19:59 +08:00
|
|
|
export let form_position: "first" | "last" | "mid" | "single" = "single";
|
2022-03-03 00:42:43 +08:00
|
|
|
|
|
|
|
const dispatch = createEventDispatcher<{ change: string }>();
|
|
|
|
|
2022-04-06 01:11:29 +08:00
|
|
|
$: dispatch("change", value);
|
2022-03-03 00:42:43 +08:00
|
|
|
</script>
|
|
|
|
|
2022-04-22 17:19:59 +08:00
|
|
|
<Block {form_position}>
|
2022-04-06 01:11:29 +08:00
|
|
|
<label>
|
|
|
|
<BlockTitle>{label}</BlockTitle>
|
2022-04-21 17:27:12 +08:00
|
|
|
<select
|
|
|
|
class="gr-box gr-input w-full disabled:cursor-not-allowed"
|
|
|
|
bind:value
|
|
|
|
{disabled}
|
|
|
|
>
|
2022-03-03 00:42:43 +08:00
|
|
|
{#each choices as choice, i}
|
2022-04-06 01:11:29 +08:00
|
|
|
<option>{choice}</option>
|
2022-03-03 00:42:43 +08:00
|
|
|
{/each}
|
2022-04-06 01:11:29 +08:00
|
|
|
</select>
|
|
|
|
</label>
|
|
|
|
</Block>
|