This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
bandolier-template/client/components/FormField.svelte

36 lines
898 B

<script>
export let form = {};
export let field = "";
export let label=field;
/* Use for checkbox where the check needs to be "inline" with the label. */
export let inline = false;
</script>
{#if form}
{#if inline}
{#if !form._valid && form._errors && form._errors[field]}
{#each form._errors[field] as error, i}
<error data-testid="{field}-error-{i}">
{ error }
</error>
{/each}
{/if}
<label for={ field }>
<slot></slot> { label }
</label>
{:else}
<label for={ field }>{ label }</label>
{#if !form._valid && form._errors && form._errors[field]}
{#each form._errors[field] as error, i}
<error data-testid="{field}-error-{i}">
{ error }
</error>
{/each}
{/if}
<slot></slot>
{/if}
{:else}
<callout class="error">
No form property. Check your code.
</callout>
{/if}