NumberSpinner
Wrapper for Sitevision number spinner.
This is a field description.
Example
Section titled “Example”<script> import { Panel, NumberSpinner } from '@soleil-se/config-svelte';</script>
<Panel heading="Inställningar"> <NumberSpinner name="height" label="Height" min={0} max={500} step={5} suffix="px" /></Panel>| Prop | Type | Description |
|---|---|---|
labelrequired | string | Snippet | Field label, a string or Svelte snippet. |
value$bindable | number | Numeric field value. Default:min ?? 1 |
name | string | Configuration key and HTML name attribute. |
description | string | Snippet | Description shown below the field, a string or Svelte snippet. |
min | number | Minimum spinner value. |
max | number | Maximum spinner value. |
step | number | Increment used by the spinner controls. Default:1 |
decimals | number | Number of decimal places handled by the Sitevision spinner. Default:0 |
suffix | string | [string, string] | Text displayed after the value, or singular and plural forms. For a pair, the first string is used when the value is |
disabled | boolean | Disables the spinner. Default:false |
readonly | boolean | Prevents editing while keeping the spinner focusable. Default:false |
show | boolean | Shows or hides the spinner without destroying it. Default:true |
class | string | CSS class added to the form-group wrapper. |
children | Snippet | Content rendered after the spinner and validation message. |
onInput | function | Called for the jQuery input event with the updated numeric value. |
onChange | function | Called for the jQuery change event with the updated numeric value. |
validate | function | Custom validator. |
Suffix
Section titled “Suffix”The suffix can be a string, or a pair of strings for singular and plural values. The singular suffix is used when the value is exactly 1.
<NumberSpinner name="height" label="Height" min={1} max={500} suffix="px" /><NumberSpinner name="hours" label="Hours" min={1} max={24} suffix={['hour', 'hours']} />Validation
Section titled “Validation”By default, the component applies standard required-field validation. A custom validate prop
replaces that default and returns { success: boolean, message?: string }.
Validation errors are displayed below the component and prevent saving.
See validation for more details.
Snippets
Section titled “Snippets”label and description accept text or Svelte snippets.
Default child content is rendered after the number spinner and validation message.
<script> import { NumberSpinner } from '@soleil-se/config-svelte';</script>
<NumberSpinner name="height"> {#snippet label()} Ange <strong>höjd</strong> {/snippet} {#snippet description()} Ange höjd i <strong>centimeter</strong>. {/snippet} <p>Ytterligare information.</p></NumberSpinner>