0.3.4 • Published 2 years ago
svelte-knobby v0.3.4
svelte-knobby
Add knobs to your Svelte apps. Demo
<script>
import * as knobby from 'svelte-knobby';
const controls = knobby.panel({
// primitive values are handled automatically
message: 'Hello World!',
color: '#ff3e00',
clicks: 0,
checked: false,
// functions become buttons. if state is returned, it will
// update the store
increment: value => ({
...value,
clicks: value.clicks + 1
}),
// specify options by using a { value } object
constrained: {
// any object can be given a $label which will
// appear in place of the property name
$label: 'labelled input',
value: 50,
min: 0,
max: 100,
step: 1
},
// objects that can't be 'interpreted' (see below)
// are treated as folders
folder: {
$label: 'labelled folder',
a: 1, // accessed as $controls.folder.a
b: 2,
nested: {
c: 3, // accessed as $controls.folder.nested.c
d: 4
}
}
});
// the returned store is writable
$controls.message = 'Hello Knobby!';
</script>
<h1>{$controls.message}</h1>
Interpreting values
TODO
Plugins
License
MIT
0.3.4
2 years ago
0.3.2
2 years ago
0.3.3
2 years ago
0.3.1
3 years ago
0.3.0
3 years ago
0.2.0
3 years ago
0.1.15
3 years ago
0.1.11
3 years ago
0.1.12
3 years ago
0.1.13
3 years ago
0.1.14
3 years ago
0.1.10
3 years ago
0.1.8
3 years ago
0.1.7
3 years ago
0.1.9
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.0
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago