【问题标题】:extendTheme for Chakra-ui in Gatsby盖茨比中 Chakra-ui 的扩展主题
【发布时间】:2020-11-18 06:54:56
【问题描述】:

我在 Gatbsy 工作,当我尝试使用 gatsby-plugin-chakra-ui 文件夹中的影子 theme.js 文件覆盖核心 Chakra 主题时,它没有任何效果。

请问有什么想法吗?我正在使用

import { extendTheme } from '@chakra-ui/core'

const theme = extendTheme({
        components: {
                Input: {
                        variants: {
                                outline: {
                                        borderColor: 'blue.500',
                                },
                        },
                },
        },
})

编辑:修改主题适用于 Button 组件,但不适用于 Input

【问题讨论】:

    标签: gatsby gatsby-plugin chakracore chakra-ui


    【解决方案1】:

    要自定义输入元素字段,您只需在outline 对象内添加field 属性,如下所示:

    import { extendTheme } from '@chakra-ui/core'
    
    const theme = extendTheme({
      components: {
        Input: {
          variants: {
            outline: {
              field: {
                borderColor: 'blue.500',
              },
            },
          },
        },
      },
    })

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-18
      • 1970-01-01
      • 2021-08-22
      • 2021-12-24
      • 2021-01-02
      • 2020-12-05
      • 2021-11-23
      • 2020-10-16
      相关资源
      最近更新 更多