Public
Edited
Jan 22
Insert cell
Insert cell
Insert cell
Insert cell
penguins
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
penguins.columns
Insert cell
Inputs.table(penguins, {
columns: [
"species",
"culmen_length_mm",
"culmen_depth_mm",
"flipper_length_mm"
],
header: {
species: "Penguin Species",
culmen_length_mm: "Culmen length (mm)",
flipper_length_mm: "Flipper length (mm)",
culmen_depth_mm: "Culmen Depth (mm)"
}
})
Insert cell
Insert cell
Inputs.table(penguins, {sort: "body_mass_g", reverse: true})
Insert cell
Insert cell
viewof selection = Inputs.table(penguins, {required: false})
Insert cell
selection // Try selecting rows above!
Insert cell
Insert cell
Insert cell
Inputs.table(penguins, {
format: {
culmen_length_mm: x => x.toFixed(1),
culmen_depth_mm: x => x.toFixed(1),
sex: x => x === "MALE" ? "M" : x === "FEMALE" ? "F" : ""
}
})
Insert cell
Insert cell
Inputs.table(penguins, {
format: {
culmen_length_mm: sparkbar(d3.max(penguins, d => d.culmen_length_mm)),
culmen_depth_mm: sparkbar(d3.max(penguins, d => d.culmen_depth_mm)),
flipper_length_mm: sparkbar(d3.max(penguins, d => d.flipper_length_mm)),
body_mass_g: sparkbar(d3.max(penguins, d => d.body_mass_g)),
sex: x => x.toLowerCase()
}
})
Insert cell
function sparkbar(max) {
return x => htl.html`<div style="
background: lightblue;
width: ${100 * x / max}%;
float: right;
padding-right: 3px;
box-sizing: border-box;
overflow: visible;
display: flex;
justify-content: end;">${x.toLocaleString("en")}`
}
Insert cell
Insert cell
Insert cell
Inputs.table(penguins, {
width: {
culmen_length_mm: 140,
culmen_depth_mm: 140,
flipper_length_mm: 140
},
align: {
culmen_length_mm: "right",
culmen_depth_mm: "center",
flipper_length_mm: "left"
},
rows: 18,
maxWidth: 840,
multiple: false,
layout: "fixed"
})
Insert cell
Insert cell
Inputs.table(penguins, {
value: penguins.filter((_, i) => [1, 3, 7, 9].includes(i)),
multiple: true
})
Insert cell
Insert cell
Insert cell
Table = Inputs.table // deprecated alias
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more