Svelte actions and data bindings for Semantic UI components.
https://fomantic-ui.com/
https://svelte.dev/
<script lang="ts">
import { InitForm, InitDropdown, InitNumberInput } from "@svelte-gear/svelte-semantic-ui";
let liveValidation: boolean = $state(true);
let isValid: boolean = $state(true);
let country: string = $state("");
let salary: number | undefined = $state();
</script>
<form class="ui form"
<InitForm
active={liveValidation}
bind:valid={isValid}
settings={{...}}>
/>
<select class="ui dropdown selection">
<option value="CA">Canada</option>
<option value="MX">Mexico</option>
<option value="US">USA</option>
</select>
<InitDropdown
bind:value={country}
validate={["empty", "not[US]"]}
settings={{...}}>
/>
<input type="text" class="ui input" />
<InitNumberInput
bind:value={salary}
validate={["empty", "minLength[5]"]}
settings={{ type: "money" }}
/>
</form>
<Init*>
components to replace jQuery code. (see doc/COMPONENTS.md
)Init*
components allow to set and receive value
from Dropdown, Calendar, Slider components, input, or textarea.InitModal
controls Modal component visibility through show
binding.Init*
should follow the Semantic UI component, input, or textarea that it controls.InitForm
may additionally be used as a child of the form.Init*
as a parent or a child of the component.settings
prop in the Init*
component.InitDateInput
, InitNumberInput
, and InitTextInput
with field formatting behavior.InitDateInput
works very similar to the calendar component, as both take user input and produce a date object.InitNumberInput
supports integer, decimal and money formats controlled by i18n number settings.InitTextInput
may be used for simple formatting or validation.<Init* validate={...}
to define the rules using Semantic UI syntax (see https://fomantic-ui.com/behaviors/form.html#/settings)src/lib/data/validation-rules.ts
)examples/i18n/src/extra-locales/
)