Public
Edited
Aug 5, 2024
Insert cell
Insert cell
width
Insert cell
Inputs.radio(letters)
Insert cell
letters = d3.range(26).map(i => String.fromCharCode(97 + i));
Insert cell
Inputs.radio(
letters,
{
style: "width: 1000px;"
}
)
Insert cell
viewof selection = html`
<div style="width: 1000px; padding: 10px;">
${Inputs.radio(
letters,
{ label: "Choose a letter:", value: "a" }
)}
</div>
`
Insert cell
viewof selection2 = html`
<style>
.radio-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
max-width: 100%;
}
.radio-container > form {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.radio-container label {
display: flex;
align-items: center;
margin-right: 10px;
}
</style>
<div class="radio-container">
${Inputs.radio(
letters,
{ label: "Choose a letter:", value: "a" }
)}
</div>
`
Insert cell
viewof selection3 = {
const form = html`
<style>
.custom-radio-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
max-width: 100%;
}
.custom-radio-label {
display: inline-flex;
align-items: center;
margin-right: 10px;
}
</style>
<form class="custom-radio-container">
${letters.map(letter => html`
<label class="custom-radio-label">
<input type="radio" name="letter" value="${letter}" ${letter === "a" ? "checked" : ""}>
${letter}
</label>
`)}
</form>
`;
form.oninput = () => form.value = form.querySelector('input:checked').value;
form.value = "a";
return form;
}
Insert cell
selection3
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