Published
Edited
Mar 9, 2022
Importers
42 stars
Also listed in…
Widgets and helpers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
signature(demoFunction, {
description: `Scales dimensions proportionally to fit into the given width and/or height.`,
example: `const [width, height, scale] = scaleContain(img.naturalWidth, img.naturalHeight, 500, 500);`,
css: `
${signature_theme}
:scope {
background: LightYellow;
box-shadow: 1px 2px 5px -3px;
font-family: sans-serif;
}
:scope .description {
font-size: 1.2rem;
font-style: italic;
}
:scope .examples .code {
background: NavajoWhite;
}
`,
})
Insert cell
Insert cell
// Scope is applied as a class - note the dot in the scope argument.
scopedStyle('.my-shared-scope', `
${signature_theme}
// Adds
:scope { border: 10px solid #888 }
`)
Insert cell
function myCustomSig(fn, options = {}) {
return signature(fn, {scope: 'my-shared-scope', css: null, ...options});
}
Insert cell
myCustomSig(demoFunction, {
description: `Scales dimensions proportionally to fit into the given width and/or height.`,
example: `const [width, height, scale] = scaleContain(img.naturalWidth, img.naturalHeight, 500, 500);`,
})
Insert cell
Insert cell
Insert cell
Insert cell
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