Published
Edited
Oct 15, 2021
1 fork
13 stars
Insert cell
Insert cell
Insert cell
viewof color = Inputs.radio(["red", "green", "blue"], {label: "color"})
Insert cell
color
Insert cell
html`<div style="background-color: ${color}; width: 25px; height: 25px;">`
Insert cell
Insert cell
viewof vote = Inputs.radio(["Yea", "Nay", null], {value: null, format: x => x ?? "Abstain"})
Insert cell
vote
Insert cell
Insert cell
teams = [
{name: "Lakers", location: "Los Angeles, California"},
{name: "Warriors", location: "San Francisco, California"},
{name: "Celtics", location: "Boston, Massachusetts"},
{name: "Nets", location: "New York City, New York"},
{name: "Raptors", location: "Toronto, Ontario"},
]
Insert cell
viewof favorite = Inputs.radio(teams, {label: "Favorite team", format: x => x.name})
Insert cell
favorite
Insert cell
Insert cell
viewof vowel = Inputs.radio([..."AEIOUY"], {label: "Vowel", disabled: ["Y"]})
Insert cell
vowel
Insert cell
Insert cell
viewof color2 = Inputs.radio(["red", "green", "blue"], {value: "red", label: html`<b>Color</b>`, format: x => html`<span style="text-transform: capitalize; border-bottom: solid 2px ${x}; margin-bottom: -2px;">${x}`})
Insert cell
color2
Insert cell
Insert cell
viewof size = Inputs.radio(new Map([["Short", 8], ["Tall", 12], ["Grande", 16], ["Venti", 20]]), {value: 12, label: "Size"})
Insert cell
size
Insert cell
Insert cell
viewof size2 = Inputs.radio(
new Map([["Short", 8], ["Tall", 12], ["Grande", 16], ["Venti", 20]]),
{value: 12, label: "Size", format: ([name, value]) => `${name} (${value} oz)`}
)
Insert cell
size2
Insert cell
Insert cell
athletes = FileAttachment("athletes.csv").csv({typed: true})
Insert cell
viewof goldAthletes = Inputs.radio(d3.group(athletes, d => d.gold), {label: "Gold medal count", sort: "descending"})
Insert cell
goldAthletes
Insert cell
Insert cell
viewof base = Inputs.radio("GATTACA", {sort: true, unique: true})
Insert cell
base
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