Using Webfonts in Widgets
Overview
Step 1 - Load Fonts
IDE Users
// widget.ts
declare const sdk: ISdk
import { fonts } from "./fonts"
loadWidget({
config: {
fonts: fonts
}
})
```;
```fonts.ts
export const fonts = [
{
fontFamily: "HelveticaNeueLtPro",
src: [
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Roman.ttf", format: "truetype" }
],
fontWeight: "normal",
fontStyle: "normal"
},
{
fontFamily: "HelveticaNeueLtPro",
src: [
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Md.woff2", format: "woff2" },
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Md.woff", format: "woff" }
],
fontWeight: 500,
fontStyle: "normal",
fontDisplay: "swap"
},
{
fontFamily: "HelveticaNeueLtPro",
src: [
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Lt.woff2", format: "woff2" },
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Lt.woff", format: "woff" }
],
fontWeight: 400,
fontStyle: "normal",
fontDisplay: "swap"
},
{
fontFamily: "HelveticaNeueLtPro",
src: [
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Bd.ttf", format: "truetype" }
],
fontWeight: "700",
fontStyle: "normal"
},
{
fontFamily: "HelveticaNeueLtPro",
src: [
{ url: "https://templates.stackla.com/assets/fonts/helvetica/HelveticaNeueLTPro-Bd.ttf", format: "truetype" }
],
fontWeight: "bold",
fontStyle: "normal"
}
]Non-IDE Users
Last updated