feat: create inputChoice

This commit is contained in:
Arman committed 2022-09-06 18:32:17 +02:00
1 parent ec7f894e4d
commit c81e1ccec0
2 files changed
+31

No files matched your search

+1
View File
@@ -15,5 +15,6 @@ export { default as InputSearch } from './inputSearch.svelte';
export { default as InputRadio } from './inputRadio.svelte';
export { default as InputSelect } from './inputSelect.svelte';
export { default as InputCheckbox } from './inputCheckbox.svelte';
export { default as InputChoice } from './inputChoice.svelte';
export { default as InputPhone } from './inputPhone.svelte';
export { default as Helper } from './helper.svelte';
+30
View File
@@ -0,0 +1,30 @@
<script lang="ts">
import { FormItem } from '.';
export let type: 'checkbox' | 'switchbox' = 'checkbox';
export let label: string;
export let showLabel = true;
export let id: string;
export let value = false;
export let required = false;
export let disabled = false;
</script>
<FormItem>
<label class="choice-item" for={id}>
<input
{id}
{disabled}
{required}
type="checkbox"
class:switch={type === 'switchbox'}
bind:checked={value} />
<div class="choice-item-content">
<div class:u-hide={!showLabel} class="choice-item-title">{label}</div>
{#if $$slots}
<p class="choice-item-paragraph"><slot /></p>
{/if}
</div>
</label>
</FormItem>