Embed options
The dashboard builds the embed code for you. This page explains what each part does, in case you want to change it by hand.
Family or group
| Attribute | Shows |
|---|---|
data-fontsbox-family="123" | One font family. The number is in the embed code on the family page. |
data-fontsbox-group="45" | An embed group: several families in one block. Create groups under Embed groups. |
Controls
data-controls lists the controls to show, separated by commas. Leave the attribute out to show all of them.
| Value | Control |
|---|---|
style | A menu to show one style, or all of them |
sync | A chain button to edit all styles together, or one at a time: unlinked, the text and every control change only the row last clicked (shown with more than one style) |
size | Font size slider |
spacing | Letter spacing slider |
lineheight | Line height slider |
axes | A slider for each axis of a variable font, such as weight or width (only shown for variable fonts) |
align | Left, center and right alignment |
features | A menu of the OpenType features the font supports, such as ligatures or stylistic sets |
glyphs | A Glyphs tab that shows every character |
opentype | An OpenType tab with a demo card for each feature: the characters it changes are highlighted, with a switch to compare |
fit | Autofit: scales the text so its longest line fills the width |
invert | Switch between light and dark |
reset | Put the preview text back to your default |
buy | A “Get font ↗” button next to each style that has a Link |
<div data-fontsbox-family="123" data-controls="style,size,invert"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Glyphs only
Add data-view="glyphs" to show the character grid without the type tester.
<div data-fontsbox-family="123" data-view="glyphs"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>data-view="opentype" does the same for the OpenType feature demos.
Hide the controls until they're needed
For a cleaner look, add data-shy="hover" to show the controls only while the visitor points at the embed, or data-shy="focus" to show them once the visitor clicks or taps into it. Until then, a slim header shows the family's name, a "Click any text to try it" note and, if your styles share one Link, a "Get font" button. The controls then take the header's place in one compact row (text, size, features, and a "⋯" menu with everything else), so nothing on your page moves and the first style stays in view. They hide again when the visitor clicks elsewhere or presses Escape. Phones and tablets have no hover, so there the controls show when the visitor taps the text.
<div data-fontsbox-family="123" data-shy="hover"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Start with one style
Add data-style with a style ID to show that style first. You'll find the Style ID under each style on the family page.
<div data-fontsbox-family="123" data-style="678"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Several embeds on one page
Add as many <div>s as you like. You only need the <script> line once per page, but including it more than once does no harm.
<div data-fontsbox-family="123"></div>
<div data-fontsbox-family="124" data-view="glyphs"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Buy link
"Get font ↗" buttons open your links in a new tab. A Family link (set above the styles on the family page) shows at the top of the embed; a style's own Link shows on that style's row. Without a family link, a link that every style shares shows once at the top instead of on every row. It's the buy control: included when you leave data-controls out, and hidden when your list doesn't name it.
<div data-fontsbox-family="123" data-controls="style,size,buy"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Variable fonts
For a variable font, the tester shows a slider for each axis you tick under Axes shown in embeds at the top of the family's Embed card. By default that is weight, width, optical size, slant and italic, when the font has them. Axes you leave unticked keep the font's default value.
With one or two axes, the sliders sit in the toolbar; with more, they go into an Axes menu so the preview text stays in view. In an embed 768px wide or narrower they are always in the menu. Use data-axes-position="inline" or "panel" to choose for one embed.
<div data-fontsbox-family="123" data-axes-position="panel"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Preview text and sizes
The starting text, font size, letter spacing and line height come from each style's settings in the dashboard. Change them there and every embed updates, with no need to touch your site.
Which of the three sizes is used depends on how wide the embed itself is, not the visitor's screen: 768px or narrower uses the mobile size, up to 1024px the tablet size, and wider the desktop size. A tester in a narrow column therefore gets the mobile size even on a large screen, and it switches when that space resizes.
Fixed height
Add data-height with a number of pixels to keep the embed at exactly that height, toolbar included. Whatever visitors type, whichever size they pick and whatever menu they open, the embed doesn't grow or shrink, so the rest of your page never moves. Use data-height-tablet and data-height-mobile for narrower embeds (the same widths as the sizes below); each falls back to the next wider one.
Text that doesn't fit is cut off under a soft fade at the bottom. Add data-overflow="scroll" to let visitors scroll inside the preview instead. The Glyphs and OpenType tabs always scroll inside the box. Menus such as Axes and Features open over the text. In the dashboard, this is Fixed height under Size and height.
<div data-fontsbox-family="123" data-height="480" data-height-mobile="380"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Largest size and Autofit
data-size-max sets the largest font size in pixels: the Size slider stops there (it goes up to 240 otherwise), and neither a style's default size nor Autofit goes past it. It keeps short words from growing huge in a fixed-height embed. Add data-fit="true" to start with Autofit on, so the text fills the width; visitors can switch it off with the Autofit button.
<div data-fontsbox-family="123" data-height="520" data-size-max="160" data-fit="true"></div>
<script src="https://fb-emb.digture.id/embed.js" async></script>Look and layout
The tester fills the width of the element you put it in, and your site's CSS doesn't change how it looks. To make it narrower, place the <div> inside a narrower container. For more room around the text, set --fontsbox-preview-padding on the <div>, for example style="--fontsbox-preview-padding: 32px 48px" (the default is 18px 14px). See Troubleshooting if it doesn't appear.