New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-chakra-ui

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-chakra-ui

Drop-in Chakra UI support for Gatsby sites

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
119
decreased by-19.05%
Maintainers
3
Weekly downloads
 
Created
Source

🚨 Chakra v0 is no longer supported and this plugin is likely broken! Please upgrade to Chakra UI v1 and use @chakra-ui/gatsby-plugin instead. Visit https://chakra-ui.com/ for more information. 🚨

gatsby-plugin-chakra-ui

Drop-in Chakra UI support for Gatsby sites

Installation

⚡ To use Chakra UI in your Gatsby site, you need to install the plugin and its peer dependencies.

$ yarn add gatsby-plugin-chakra-ui @chakra-ui/core @emotion/core @emotion/styled emotion-theming

Usage

Basic

  1. Add gatsby-plugin-chakra-ui as a plugin in your Gatsby config.
// gatsby-config.js
module.exports = {
  plugins: ["gatsby-plugin-chakra-ui"],
};
  1. Use Chakra ⚡
// src/pages/index.js
import React from "react";
import { Box, Text } from "@chakra-ui/core";

function IndexPage() {
  return (
    <Box p={8}>
      <Text fontSize="xl">Hello World</Text>
    </Box>
  );
}

export default IndexPage;

Gatsby plugin options

By default, this plugin makes use of Chakra CSS reset component and color mode context:

<ThemeProvider theme={theme}>
  <CSSReset />
  <ColorModeProvider>{element}</ColorModeProvider>
</ThemeProvider>

You can disable either of these with Gatsby options:

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-plugin-chakra-ui",
      options: {
        /**
         * @property {boolean} [isResettingCSS=true]
         * if false, this plugin will not use `<CSSReset />
         */
        isResettingCSS: true,
        /**
         * @property {boolean} [isUsingColorMode=true]
         * if false, this plugin will not use <ColorModeProvider />
         */
        isUsingColorMode: true,
      },
    },
  ],
};

Custom theme

To use custom theme, you can shadow this plugin's theme.js file with your own theme:

// src/gatsby-plugin-chakra-ui/theme.js
const theme = {};

export default theme;

You can learn more about custom theme at Chakra UI's documentation.

By default, Chakra provides a sensible default theme inspired by Tailwind CSS.

Keywords

FAQs

Package last updated on 20 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc