如何更改 typeform 按钮字体?

How to change typeform button font?

我在 React 项目中嵌入了以下类型:

import { PopupButton } from '@typeform/embed-react'

const MyComponent = () => {
  return (
    <PopupButton id="<form-id>" style={{ fontSize: 20; fontFamily: "Helvetica" }} className="my-button">
      click to open form in popup
    </PopupButton>
  )
}

但是,虽然字体更改适用于我的 div,但它不适用于 PopupButton 组件。如何更改其中包含的“单击以在弹出窗口中打开表单”的字体?

PopupButton 组件将允许您通过 style 属性更改按钮 CSS。

在你的情况下,你在 style prop 中的对象中有错字,它包含分号 (;) 而不是 fontSize 之后的冒号 (,) .当您使用冒号 (,) 时,它有效:

<PopupButton id="<form-id>" style={{ fontSize: 20, fontFamily: "Helvetica" }} className="my-button">
  click to open form in popup
</PopupButton>

我在这里做了一个快速测试,它按预期工作: https://codesandbox.io/s/charming-shaw-92ber?file=/src/App.js