Files
nodarium/packages/ui/src/lib/Input.svelte
Max Richter 1ea544e765
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 3m33s
chore: rename @nodes -> @nodarium for everything
2025-12-01 17:03:14 +01:00

30 lines
860 B
Svelte

<script lang="ts">
import Checkbox from './elements/Checkbox.svelte';
import Float from './elements/Float.svelte';
import Integer from './elements/Integer.svelte';
import Select from './elements/Select.svelte';
import type { NodeInput } from '@nodarium/types';
import Vec3 from './elements/Vec3.svelte';
interface Props {
input: NodeInput;
value: any;
id: string;
}
let { input, value = $bindable(), id }: Props = $props();
</script>
{#if input.type === 'float'}
<Float {id} bind:value min={input?.min} max={input?.max} />
{:else if input.type === 'integer'}
<Integer {id} bind:value min={input?.min} max={input?.max} />
{:else if input.type === 'boolean'}
<Checkbox {id} bind:value />
{:else if input.type === 'select'}
<Select {id} bind:value options={input.options} />
{:else if input.type === 'vec3'}
<Vec3 {id} bind:value />
{/if}