Inside your React project directory, install Chakra UI by running the following:
For
create-react-app
installation instructions, check this CRA templates guide.
For Chakra UI to work correctly, you need to setup the ChakraProvider
at the
root of your application.
Go to the root of your application and do this:
- For Next.js, you need to set this up in
pages/_app.js
orpages/_app.tsx
- For Gatsby, install the
@chakra-ui/gatsby-plugin
. It does it automatically for you.- For Create React App, you need to set this up in
index.js
orindex.tsx
If you need to customize the default chakra theme to match your design
requirements, you can extend the theme
from @chakra-ui/react
.
Chakra UI provides an extendTheme
function that deep merges the default theme
with your customizations.
Name | Type | Default | Description |
---|---|---|---|
resetCSS | boolean | true | automatically includes <CSSReset /> |
theme | Theme | @chakra-ui/theme | optional custom theme |
colorModeManager | StorageManager | localStorageManager | manager to persist a users color mode preference in |
portalZIndex | number | undefined | common z-index to use for Portal |
That's it, you're good to go!
@chakra-ui/icons
@chakra-ui/theme-tools
.Please note that when adding Chakra UI to a TypeScript project, a minimum
TypeScript version of 3.8.0
is required.
If you're adding Chakra UI to a create-react-app
project, this means you'll
need to manually upgrade typescript
to ^3.8.0
.
See the guide for our create-react-app
templates if you'd like to generate a Chakra-enabled create-react-app
project
from scratch.
Please see our contribution guidelines to learn how you can contribute to this project.