There are following components included:
Range
Name | Type | Default | Description |
---|---|---|---|
colors | object | Object with Tailwind CSS colors classes | |
colors.thumbBgIos | string | 'bg-white' | |
colors.thumbBgMaterial | string | 'bg-md-light-primary dark:bg-md-dark-primary' | |
colors.valueBgIos | string | 'bg-primary' | |
colors.valueBgMaterial | string | 'bg-md-light-primary dark:bg-md-dark-primary' | |
disabled | boolean | false | Defines whether the range input is disabled |
inputId | string | Range input id attribute | |
max | number | 100 | Range max value |
min | number | 0 | Range min value |
name | string | Range input name | |
onBlur | function(e) |
| |
onChange | function(e) |
| |
onFocus | function(e) |
| |
onInput | function(e) |
| |
readonly | boolean | false | Defines whether the range input is readonly |
step | number | 1 | Range step |
value | any | Range value |
<script>import {Page,Navbar,NavbarBackLink,BlockTitle,BlockHeader,List,ListItem,Range,} from 'konsta/svelte';let volume = $state(50);let price = $state(150);let red = $state(100);let green = $state(50);let blue = $state(75);</script><Page><Navbar title="Range Slider">{#snippet left()}{#if !isPreview}<NavbarBackLink onclick={() => history.back()} />{/if}{/snippet}</Navbar><BlockTitle>Volume: {volume}</BlockTitle><BlockHeader>From 0 to 100 with step 10</BlockHeader><List strong inset><ListItem innerClass="flex space-x-4 rtl:space-x-reverse">{#snippet inner()}<span>0</span><Rangevalue={volume}step={10}onInput={(e) => (volume = e.target.value)}/><span>100</span>{/snippet}</ListItem></List><BlockTitle>Price: ${price}</BlockTitle><BlockHeader>From 0 to 1000 with step 1</BlockHeader><List strong inset><ListItem innerClass="flex space-x-4 rtl:space-x-reverse">{#snippet inner()}<span>$0</span><Rangevalue={price}step={1}min={0}max={1000}onInput={(e) => (price = e.target.value)}/><span>$1000</span>{/snippet}</ListItem></List><BlockTitle>Color: rgb({red}, {green}, {blue})</BlockTitle><List strong inset><ListItem>{#snippet inner()}<Rangeclass="k-color-brand-red"value={red}step={1}min={0}max={255}onInput={(e) => (red = e.target.value)}/>{/snippet}</ListItem><ListItem>{#snippet inner()}<Rangeclass="k-color-brand-green"value={green}step={1}min={0}max={255}onInput={(e) => (green = e.target.value)}/>{/snippet}</ListItem><ListItem>{#snippet inner()}<Rangeclass="k-color-brand-blue"value={blue}step={1}min={0}max={255}onInput={(e) => (blue = e.target.value)}/>{/snippet}</ListItem></List></Page>