-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from MuckRock/400-addon-dropdown
Use select input for text fields with enum property
- Loading branch information
Showing
4 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script lang="ts"> | ||
import Field from "./Field.svelte"; | ||
export let title: string; | ||
export let name: string; | ||
export let defaultValue: string = ""; | ||
export let value: string = defaultValue || null; | ||
export let required: boolean = false; | ||
export let description: string = ""; | ||
export let inline = false; | ||
export let choices: string[] = []; | ||
</script> | ||
|
||
<Field {title} {description} {inline} {required}> | ||
<select {name} bind:value on:input on:focus on:change on:blur> | ||
{#if !required} | ||
<option value="">---</option> | ||
{/if} | ||
{#each choices as choice} | ||
<option value={choice}>{choice}</option> | ||
{/each} | ||
</select> | ||
</Field> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters