Public
Edited
Nov 22, 2023
Importers
Insert cell
Insert cell
Insert cell
testNoUpdate
Insert cell
viewof TestUpdate = interval([0,10], {label: "TestUpdate"})
Insert cell
TestUpdate
Insert cell
function interval(range = [], options = {}) {
const [min = 0, max = 1] = range;
const {
step = 0.001,
label = null,
value = [min, max],
format = ([start, end]) => `${start} … ${end}`,
updateOnSlide = true,
color,
width,
theme
} = options;
const ele = Inputs.range(range, options);
let container = html`<div></div>`;

ele.addEventListener("input", (evt) => {
evt.stopPropagation();
container.value = ele.value;
if (updateOnSlide) {
container.dispatchEvent(new Event("input", { bubbles: true }));
}
});

ele.addEventListener("change", (evt) => {
evt.stopPropagation();
container.value = ele.value;
container.dispatchEvent(new Event("input", { bubbles: true }));
});

container.appendChild(ele);
container.value = ele.value;
return container;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more