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

41 lines
987 B
Svelte
Raw Normal View History

<script lang="ts">
2022-03-08 21:35:42 +08:00
import { Range } from "@gradio/form";
import { Block } from "@gradio/atoms";
import StatusTracker from "../StatusTracker/StatusTracker.svelte";
import type { LoadingStatus } from "../StatusTracker/types";
import type { Styles } from "@gradio/utils";
2022-03-08 21:35:42 +08:00
export let elem_id: string = "";
2022-03-12 00:00:48 +08:00
export let value: number = 0;
export let label: string = "Slider";
export let style: Styles = {};
export let minimum: number;
export let maximum: number;
export let step: number;
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: LoadingStatus;
</script>
<Block
{form_position}
{elem_id}
disable={typeof style.container === "boolean" && !style.container}
>
<StatusTracker {...loading_status} />
<Range
bind:value
{label}
{show_label}
{minimum}
{maximum}
{step}
{style}
disabled={mode === "static"}
on:change
/>
</Block>