-
-
Notifications
You must be signed in to change notification settings - Fork 282
Expand file tree
/
Copy path_DifferentTypes.svelte
More file actions
57 lines (49 loc) · 1.29 KB
/
_DifferentTypes.svelte
File metadata and controls
57 lines (49 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<div class="columns margins">
<div>
<Textfield bind:value={valueTypeNumber} label="Number" type="number" />
</div>
<div>
<Textfield
bind:value={valueTypeNumberStep}
label="Number with Step"
type="number"
input$step="2"
/>
</div>
<div>
<Textfield
bind:value={valueTypeDate}
label="DateTime-Local"
type="datetime-local"
/>
</div>
<div class="hide-file-ui">
<!--
Note: the change and input events fire
before the `files` prop is updated.
-->
<Textfield bind:files={valueTypeFiles} label="File" type="file" />
</div>
</div>
<script lang="ts">
import Textfield from '@smui/textfield';
let valueTypeNumber = $state(0);
let valueTypeNumberStep = $state(0);
let valueTypeDate = $state('');
let valueTypeFiles: FileList | null = $state(null);
// Note: the change and input events fire before the `files` prop is updated.
$effect(() => {
if (valueTypeFiles != null && valueTypeFiles.length) {
alert('Selected ' + valueTypeFiles.length + ' file(s).');
}
});
</script>
<style>
.hide-file-ui :global(input[type='file']::file-selector-button) {
display: none;
}
.hide-file-ui
:global(:not(.mdc-text-field--label-floating) input[type='file']) {
color: transparent;
}
</style>