【问题标题】:How to change typeform button font?如何更改typeform按钮字体?
【发布时间】:2021-07-04 14:58:21
【问题描述】:

我在 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 组件。如何更改其中包含的“单击以在弹出窗口中打开表单”字体?

【问题讨论】:

    标签: reactjs typeform


    【解决方案1】:

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

    在您的情况下,您在 style 道具中的对象中有错字,它在 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-13
      • 1970-01-01
      • 1970-01-01
      • 2020-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多