mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-19 19:45:26 +03:00
initial commit
This commit is contained in:
27
frontend/src/lib/components/file-input.svelte
Normal file
27
frontend/src/lib/components/file-input.svelte
Normal file
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils/style';
|
||||
import type { HTMLInputAttributes } from 'svelte/elements';
|
||||
import type { VariantProps } from 'tailwind-variants';
|
||||
import type { buttonVariants } from './ui/button';
|
||||
|
||||
let {
|
||||
id,
|
||||
...restProps
|
||||
}: HTMLInputAttributes & {
|
||||
id: string;
|
||||
variant?: VariantProps<typeof buttonVariants>['variant'];
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => document.getElementById(id)?.click()}
|
||||
class={cn(restProps.class)}
|
||||
>
|
||||
{#if restProps.children}
|
||||
{@render restProps.children()}
|
||||
{:else}
|
||||
Select File
|
||||
{/if}
|
||||
</button>
|
||||
<input {id} {...restProps} type="file" class="hidden" />
|
||||
Reference in New Issue
Block a user