⚡️ Simple, Modular & Accessible UI Components for your React Applications

Overview

Chakra logo

Build Accessible React Apps with Speed ⚡️


Bundle Size Language grade: JavaScript MIT License NPM Downloads Github Stars Discord


Chakra UI provides a set of accessible, reusable, and composable React components that make it super easy to create websites and apps.

Looking for the documentation? 📝

For older versions, head over here => https://v0.chakra-ui.com

Latest version (v1) => https://chakra-ui.com

Features 🚀

  • Ease of Styling: Chakra UI contains a set of layout components like Box and Stack that make it easy to style your components by passing props. Learn more
  • Flexible & composable: Chakra UI components are built on top of a React UI Primitive for endless composability.
  • Accessible. Chakra UI components follow the WAI-ARIA guidelines specifications and have the right aria-* attributes.
  • Dark Mode 😍 : Most components in Chakra UI are dark mode compatible.

Support Chakra UI 💖

By donating $5 or more you can support the ongoing development of this project. We'll appreciate some support. Thank you to all our supporters! 🙏 [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Testimonials

People throw React component libraries and design systems at me regularly. This might be the best one I've seen. The APIs are simple but composable and the accessibility on the couple components I looked is complete.

Great work @thesegunadebayo, really inspiring work. – Ryan Florence

Awesome new open-source component library from @thesegunadebayo. Really impressive stuff! – Colm Tuite

This is incredible work. Amazing job Segun! – Lee Robinson

Chakra UI is glorious! I love the consistent use of focus styling and the subtle animation – Guillermo ▲

Installing Chakra UI

To use Chakra UI components, all you need to do is install the @chakra-ui/react package and its peer dependencies:

$ yarn add @chakra-ui/react @emotion/react @emotion/styled framer-motion

# or

$ npm i @chakra-ui/react @emotion/react @emotion/styled framer-motion

Usage

To start using the components, please follow these steps:

  1. Wrap your application with the ChakraProvider provided by @chakra-ui/react.
import { ChakraProvider } from "@chakra-ui/react"

// Do this at the root of your application
function App({ children }) {
  return <ChakraProvider>{children}</ChakraProvider>
}

Optionally, you can wrap your application with the ColorModeProvider so you can toggle between light and dark mode within your app.

  1. Now you can start using components like so!:
import { Button } from "@chakra-ui/react"

function Example() {
  return <Button>I just consumed some ⚡️Chakra!</Button>
}

CodeSandbox Templates

create-react-app Templates

Check out our guide for information on how to use our official create-react-app templates.

Contributing

Feel like contributing? That's awesome! We have a contributing guide to help guide you.

Contributors

Thanks goes to these wonderful people


Segun Adebayo

💻 🚧 📖 💡 🎨

Tioluwani Kolawole

📖 💡 🚧

Devansh Jethmalani

💻

Adrian Aleixandre

💻 📖

Lee

📖

Kristóf Poduszló

💻 🤔 🐛 📖

Justin Hall

💻

Mark Chandler

💻 ⚠️ 📖 🚧

Folasade Agbaje

💻 🤔

Christian Nwamba

📖

Jonathan Bakebwa

📖 🤔

Alex Luong

💻 🔌

Jesco Wüster

💻

Dusty Doris

💻

Alex Lobera

💻

Tommaso De Rossi

💻

Odi

💻

Hendrik Niemann

💻

Matt Rothenberg

💻 💡

Luis Felipe Zaguini

💻

Jean

💻

Temitope Ajiboye

📖

Jonathan Kim

💻

Chris Thompson

💻

WALTER KIMARO

💻

Jack Leslie

💻

Ken-Lauren Daganio

💻

Ramon

💻

jess

📖 🔍

Ayelegun Kayode Michael

💻

Tal Williams

💻

Trevor Blades

💻 📖 🐛

Gord Lea

💻

Aggelos Arvanitakis

💻

Douglas Gabriel

💻

Martin Nordström

💻

Danny Tatom

💻

Simon Collins

💻

Santi Albo

💻 📖

PILO7980

💻

Ishimoto Koji

💻

Jeff Wen

💻

Pablo Saez

💻

Nejc Ravnik

💻

Julien Viala

💻

Sebastian Trebunak

💻 📖

Adam Plante

💻

Lúcio Rubens

💻

Jason Miazga

💻 📖

Gonzalo Pozzo

💻

Christian

💻 🚇

Christian Hagendorn

💻

Andrey Krasnov

💻

Dony Sukardi

💻

Meng

💻

Gabriele Belluardo

💻

Francois Best

💻

Tianci He

💻

Steven

💻

Baptiste Adrien

💻

Rob Bevan

💻

Tomasz

💻

徐愷

💻

David Wippel

💻

Naveen

💻

Vincent

💻

Osamah Aldoaiss

💻

Fred K. Schott

💻

Jared Palmer

💻

Austin Walela

💻

Tony Narlock

💻 📖

Thomas Maximini

💻

David Baumgold

💻

ralphilius

💻

Rahul Rangnekar

💻

Pierre Nel

💻

Pierre Grimaud

💻

Whisp R&D

💻

Makenna Smutz

💻 📖 🤔

Nelson Reitz

💻

Mohamed Nainar

📖

Mustafa Turhan

📖

Kim Røen

📖

Justin Mak

💻

Jeremy Davis

💻

Jeremy Lu

📖 💻

Ivan Dalmet

📖 💻 🔌

Dillon Curry

💻

idfunctor

💻

denkigai

💻

Aaron Adams

💻

Abdulazeez Adeshina

💻

Sandro

💻

Premkumar Shanmugam

💻

Tobias Meixner

💻

Jeremie Leblanc

💻

Kelvin Oghenerhoro

💻

David J. Felix

💻

Brody McKee

📖

Per Svensson

💻

Patrick Cason

📖

Ivo Ilić

💻

Avaneesh Tripathi

💻

balibebas

📖

Navin Moorthy

💻 📖

Tim Kindberg

📖

iodar

📖

MAO YUFENG

📖

Peng Jie

💻 📖

James Gee

💻 ⚠️ 💡

Anton

📖

Damnjan Lukovic

📖

Stanila Andrei

💻

Ekunola Ezekiel

💻

Ben Mitchinson

📖

Jess Telford

💻

Simo Aleksandrov

📖

Héricles Emanuel

💻

CodinCat

📖

Sam Dawson

🤔

hy2k

💻

Pierre Ortega

💻

Kerem Sevencan

📖

harveyhalwin

📖

Mansour benyoucef

📖

Andrew Garrison

📖

Carlos Rodrigues

📖

Dwight Watson

📖

ChasinHues

📖

Nahuel Greco

📆 🐛

Pablo Rocha

📖

Dustin Larimer

💻 🎨

Juliano Farias

📖

Joe Bell

🐛 💻

Henning Pohlmeyer

💻

Sivert Schou Olsen

📖

Andrei Lazarescu

📖

José Teixeira

🐛

Adriano Resende

📖

Victor Bastos

📖

Vincent

📖

Candice

🎨 🐛 📖

Dave Bauman

📖

TimKolberger

🐛 📖 💻

Stephane Mensah

🐛

iskanderbroere

📖

Dominik Sumer

💻

Pavel 'Strajk' Dolecek

📖

Keshav Bohra

📖

okezieuc

📖

Clayton Faria

📖

Andrew Ellis

💻 🐛 📖

Joel Gallant

🐛

Jaya Krishna Namburu

💻

Ifeoma Imoh

📖

Jason Adkison

🐛

Gauthier Rodaro

🐛

Tom Dohnal

💻

Sam Margalit

🐛

Marcus Wood

💻

Spencer Duball

📖

Jacob Arriola

📖

Kenley Jean

📖

Dennis Morello

🐛

Umar Gora

📖

Zyclotrop-j

💻

Hong Suk Woo

📖

Junho Yeo

📖

Thomas Siller

⚠️ 💻

Samuel Kauffmann

📖

Jozef Mikuláš

💻

João Victor

💻

yuichiro miyamae

📖

Gifa Eriyanto

🐛

Yuzi

⚠️ 💻

songheewon

📖

Prasanna Venkatesh T S

📖

anthowm

📖

Osama Ahmaro

🐛

Danan Wijaya

📖

electather

🐛

Shubham Kaushal

📖

Petter Sæther Moen

📖

Herman Nygaard

📖

jnmsl

📖

Mohamed Sayed

💻

Sam Poder

📖

Dominic Lee

📖 💻

Feras Aloudah

🤔

JP Ungaretti

📖

Endika Intxaurtieta

📖

Matt Wells

💻

Anant Jain

📖

Tom Chen

📖

Ernie Miranda

📖

(emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Testing supported by

BrowserStack

License

MIT © Segun Adebayo

Issues
  • V1 Feedback

    V1 Feedback

    Hi friends,

    Please leave all feedback related to the V1 beta release here.

    or you can join our discord channel: https://discord.gg/SC6QVZd

    Thank you.

    Topic: Feedback 💬 
    opened by segunadebayo 83
  • React Native support

    React Native support

    First of all I'm sorry if this is not the correct place to do this.

    So I'm seeing this UI library and it's astonishing. I didn't see such beauty in a while and I'm wondering if we could extend this exact lib to React Native.

    I know it's a huge step and I don't expect it to be fast, but in my point of view it would be amazing since I don't know many libraries that has this kind of support.

    What do you think? We can create a RFC or an umbrella issue/PR adding that possibility. I think it would be awesome to replicate the exact same styles to the mobile platform, since they are amazing.

    Thanks in advance!

    help wanted 🆘 
    opened by zaguiini 79
  • Migrate to TypeScript

    Migrate to TypeScript

    We're currently migrating the codebase to TypeScript to provide better type safety across all components.

    If you have any typescript related concerns, kindly comment below and find a walkaround for now till the TS version is released.

    Cheers.

    PS: Want to contribute to the migration, check out the dev-ts branch.

    Topic: TypeScript 🤠 stale 
    opened by segunadebayo 66
  • Add accessible Carousel component

    Add accessible Carousel component

    WAI-ARIA Authoring Practices has a section about building accessible carousel components:

    A carousel presents a set of items, referred to as slides, by sequentially displaying a subset of one or more slides. Typically, one slide is displayed at a time, and users can activate a next or previous slide control that hides the current slide and "rotates" the next or previous slide into view. In some implementations, rotation automatically starts when the page loads, and it may also automatically stop once all the slides have been displayed. While a slide may contain any type of content, image carousels where each slide contains nothing more than a single image are common.

    I think there is a great opportunity to build a composable component by following Reach UI's Philosophy. As I've observed, there are several layers of abstraction:

    • Carousel – Similar to Reach UI's Dialog, it would just wrap the 2 children below
      • CarouselControls – Contains Rotation Control, Next Slide Control, Previous Slide Control and Slide Picker Controls
      • CarouselRotator – Touch-controllable scroll container with a hidden scrollbar
        • CarouselSlide – Holds content to be presented

    I've already started building the foundation of some components above, mostly by following a CSS-Tricks article about Scroll Snap:

    CarouselRotator

    import { Flex, FlexProps } from '@chakra-ui/core';
    import React from 'react';
    import { MarginProps, ResponsiveValue } from 'styled-system';
    import CarouselSlide from './CarouselSlide';
    
    // TODO: https://www.w3.org/TR/wai-aria-practices-1.1/#grouped-carousel-elements
    
    function negateResponsiveValue<T>(value: ResponsiveValue<T>) {
      if (value == null) return value;
      if (typeof value === 'number') return -value;
      if (typeof value === 'string') return `-${value}`;
      if (Array.isArray(value)) return value.map(v => (v != null ? `${-v}` : v));
      return Object.fromEntries(
        Object.entries(value).map(([k, v]) => [k, v != null ? `${-v}` : v]),
      );
    }
    
    export interface CarouselProps extends FlexProps {
      children: React.ReactComponentElement<typeof CarouselSlide>[];
      slideIndex?: number;
      spacing?: MarginProps['margin'];
      spacingX?: MarginProps['mx'];
      spacingY?: MarginProps['my'];
    }
    
    export default function Carousel({
      children,
      slideIndex = 0,
      spacing,
      spacingX,
      spacingY,
      ...restProps
    }: CarouselProps) {
      return (
        <Flex
          as="section"
          aria-roledescription="carousel"
          aria-live="polite" // The carousel is NOT automatically rotating
          my={negateResponsiveValue(spacingY != null ? spacingY : spacing)}
          overflow="auto"
          css={{
            scrollSnapType: 'x mandatory',
            // TODO: Leave vendor prefixing to the underlying library
            '::-webkit-scrollbar': { width: 0 },
            '-msOverflowStyle': 'none',
            scrollbarWidth: 'none',
          }}
          {...restProps}
        >
          {React.Children.map(children, (child, i) =>
            React.cloneElement(child, {
              inert: i !== slideIndex ? '' : undefined,
              px: spacingX != null ? spacingX : spacing,
              py: spacingY != null ? spacingY : spacing,
            }),
          )}
        </Flex>
      );
    }
    

    There is still a lot of work to do, e.g. adding support for automatic rotating by setting aria-live to off.

    CarouselSlide

    import { Box, BoxProps } from '@chakra-ui/core';
    import React from 'react';
    
    // TODO: Follow the status of https://github.com/WICG/inert and remove polyfill
    import 'wicg-inert';
    
    export default function CarouselSlide({
      children,
      inert,
      ...restProps
    }: BoxProps) {
      return (
        <Box
          role="group"
          aria-roledescription="slide"
          flex="0 0 100%"
          css={{ scrollSnapAlign: 'center' }}
          {...restProps}
        >
          {/* TODO: Remove extra `div` once `shouldForwardProp` of `Box` supports `inert` */}
          <div inert={inert}>{children}</div>
        </Box>
      );
    }
    

    The inert attribute is required to disable tab navigation to undisplayed slides.

    declarations.d.ts

    Unfortunately, TypeScript and React don't support the inert attribute yet, thus, it cannot be specified as a boolean, but an empty string: ''.

    declare module 'react' {
      interface DOMAttributes<T> {
        inert?: '' | undefined;
      }
    }
    
    declare global {
      namespace JSX {
        interface IntrinsicAttributes {
          inert?: '' | undefined;
        }
      }
    }
    
    export {};
    
    Type: Feature 🚀 
    opened by kripod 54
  • Warning: Prop `id` did not match. Server:

    Warning: Prop `id` did not match. Server: "popover-trigger-33" Client: "popover-trigger-6"

    Hi,

    After upgrade to @[email protected], my application working on Next.js throw a warning error.

    Maybe has some breaking changes, the internal auto-id hook instead of @reach-ui/auto-id.

    image

    Type: Bug 🐛 
    opened by nghiepit 51
  • Warning: Prop `id` did not match. Server:

    Warning: Prop `id` did not match. Server: "accordion-button-3" Client: "accordion-button-6"

    Description

    Whenever I use an accordion with NextJs, I get mismatches for ids.

    Link to Reproduction

    https://codesandbox.io/s/snowy-thunder-gxsfl?file=/pages/index.tsx:0-1603

    Steps to reproduce

    First thing first, I can't reproduce it with the codesandbox. I think it's running next start while you only see the errors with next dev...

    I still linked a codesandbox with something that will reproduce the problem when ran in local.

    To reproduce, I simply create a new page, let's say "accordion.tsx" with this code taken directly from the documentation:

    import {
      Accordion,
      AccordionButton,
      AccordionIcon,
      AccordionItem,
      AccordionPanel,
      Box,
      Heading
    } from "@chakra-ui/react";
    import React from "react";
    
    export default function IndexPage() {
      return (
        <article>
          <Heading>Welcome to Chakra UI example</Heading>
          <Accordion allowToggle>
            <AccordionItem>
              <h2>
                <AccordionButton as="button" id="ttr">
                  <Box flex="1" textAlign="left">
                    Section 1 title
                  </Box>
                  <AccordionIcon />
                </AccordionButton>
              </h2>
              <AccordionPanel pb={4}>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
                eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
                ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
                aliquip ex ea commodo consequat.
              </AccordionPanel>
            </AccordionItem>
    
            <AccordionItem>
              <h2>
                <AccordionButton>
                  <Box flex="1" textAlign="left">
                    Section 2 title
                  </Box>
                  <AccordionIcon />
                </AccordionButton>
              </h2>
              <AccordionPanel pb={4}>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
                eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
                ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
                aliquip ex ea commodo consequat.
              </AccordionPanel>
            </AccordionItem>
          </Accordion>
        </article>
      );
    }
    

    Load the page, look at the console and I get:

    Warning: Prop `id` did not match. Server: "accordion-button-3" Client: "accordion-button-6"
    

    This is new from Chakra 1.6.4.

    Everything was working fine in my project with 1.6.3.

    When I migrated to 1.6.4, I saw there had been a big modification for generating ids so they could better match between server and client. (supposedly, I never had the problem before so I have no idea why it was "fixed")

    I looked at the modified file and it was a huge change. I tried it as is, but I couldn't make it work at all in my project because with 1.6.4 pretty much all ids were a mismatch now...

    Since I was using Chakra's useId hook for my own custom components, I created a new useId with the old code and removed the import from Chakra. Everything went back to normal.

    I didn't use any accordion at the time, so I never saw any other problem. But obviously, anything that would use Chakra 1.6.4 useId will behave incorrectly with NextJs, as we can see with Accordion.

    I figured someone would eventually create an issue because the console is completely red when used with NextJs in SSG... Turns out I'm the first to report it after all :(

    Chakra UI Version

    1.6.4

    Browser

    MS Edge 91.0.864.64 (latest at the moment)

    Operating System

    • [ ] macOS
    • [X] Windows
    • [ ] Linux

    Additional Information

    I tried passing my own id to the accordion button, but it's simply ignored by Chakra implementation, it overrides it with it's own automatic id. This should be looked at, if I could somehow pass my own id, I could easily patch in the old version to generate ids, the one that worked 100% with NextJs.

    Screenshot of a simple page with only the accordion on it image

    Screenshot of the console for that same page image

    Screenshot of React Dev Tools on the Accordion Button (id = "ttr") image

    Screenshot of React Dev Tools on the Accordion Button sub component "button" (id = "accordion-button-6") image

    I have no idea why on the server the id is accordion-button-3 while on the client it's accordion-button-6.

    My repository is private, but I could invite someone from the staff to debug it if necessary.

    If you require anything else, don't hesitate to ask.

    Regards,

    TheThirdRace

    Type: Bug 🐛 Topic: Testing 🧪 Topic: SSR 💻 Topic: Next.js ▲ 
    opened by TheThirdRace 45
  • Do we need a Multiselect component?

    Do we need a Multiselect component?

    A Multiselect is a common input, and it seems like Chakra is missing it.

    The API would use a compound component API. Example:

    <Multiselect
      selectedValues={[1, 2]}
      onSelectedValuesChange={newValues => /* ... */}/>
      <Option optionValue={1}>One</Option>
      <Option optionValue={2}>Two</Option>
      <Option optionValue={3}>Three</Option>
    </Multiselect>
    

    The API could be simpler and use strict props, but it would be less flexible. The compound component pattern would allow people to switch out the <Option /> component.

    I would like to contribute to Chakra by writing this component, does this sound like a good addition?

    Type: Feature 🚀 Type: API discussion 💡 not stale 
    opened by Samic8 43
  • Any plans to include table component ?

    Any plans to include table component ?

    if any, Is it going to be implemented from scratch or wrapper around something like react-table react-table

    Type: Feature 🚀 
    opened by ngprnk 35
  • Pass styleConfig part styles to custom ClassName props

    Pass styleConfig part styles to custom ClassName props

    Feature request

    Is your feature request related to a problem? Please describe.

    I am trying to style a component from an external library using Chakra multipart component theming, the component has multiple className props for each of it's part I want to pass the part styles from the styleConfig to the part className.

    Describe the solution you'd like

    I want to be able to do something similar to this

    export const CustomComponent= () => {
        const styles = useStyleConfig('CustomComponent', {});
        return (
            <ExternalComponent 
              className={styles.container}
              wrapperClassName={styles.wrapper}
              // or 
              otherClassName={sx(styles.other)}  />
        );
    };
    

    Is this already possible? if so maybe we could add this to the docs.

    If it's not, what is the recommended alternative?

    Describe alternatives you've considered

    I can just write CSS classNames but I wanted to use the design tokens from the theme

    opened by hazem3500 35
  • Having @emotion/styled in my deps breaks all styling

    Having @emotion/styled in my deps breaks all styling

    Bug report

    Describe the bug

    If I have @emotion/styled in my dependencies - even if I don't import it, I chakra-ui components have no stylings. Precisely, every styled-system props is kept as-is and ends-up in the css - and is obviously invalid.

    To reproduce

    start a project with the latest chakra-ui (tested with rc 5, 6 and 8) and latest @emotion-styled (10.0.27). Tested with CRA 4 and latest 3.x

    Expected behavior

    I should be able to use @emotion/styled in my project alongside chakra-ui

    Screenshots

    see https://github.com/chakra-ui/chakra-ui/discussions/2409

    System information

    • OS: ubuntu
    • Browser (if applies):Chrome
    • Version of @chakra-ui/core: rc 5, 6 and 8
    • Version of Node.js: 12 something

    Additional context

    opened by olup 33
  • feat: add entrypoints for theme parts

    feat: add entrypoints for theme parts

    📝 Description

    This PR creates entry points for the theme object to help non-@chakra-ui/react users consume parts of the theme without the overhead of our large theme object.

    When I say non-@chakra-ui/react, I mean users who use @chakra-ui/system or even @chakra-ui/styled-system directly to build their internal design systems.

    💣 Is this a breaking change (Yes/No):

    No

    core team 🌼 
    opened by segunadebayo 4
  • fix(popover): add open and close delay for focus and blur events with popover hover

    fix(popover): add open and close delay for focus and blur events with popover hover

    Closes #4786

    📝 Description

    Adds consistent hover behavior for the Popover component when using an openDelay and/or closeDelay.

    ⛳️ Current behavior (updates)

    There is currently no timeout being set on the focus or blur events, so when a user hovers over a Popover with a trigger of hover and an opening and/or closing delay set, the popover's content will show immediately regardless of the delay passed to the component.

    🚀 New behavior

    Adds opening and closing delay functionality when hovering a Popover component.

    💣 Is this a breaking change (Yes/No):

    No

    📝 Additional Information

    When initiating a Popover's delayed opening, we must check to see if there is already an opening timeout set. This becomes relevant in the case when a Popover has a trigger type of hover. In this situation, both the focus and mouseEnter events will trigger when a user "clicks" the trigger (despite us not adding a click event listener for a trigger type of hover). The focus and mouseEnter both register, so there are two open timeouts running.

    opened by Brennvo 2
  • feat(modal): add onCloseComplete prop to Modal

    feat(modal): add onCloseComplete prop to Modal

    Closes #

    📝 Description

    add onCloseComplete prop to Modal, it from support provided by AnimatePresence。

    ⛳️ Current behavior (updates)

    I can't do something after the Modal close animation is over

    🚀 New behavior

    I can do something after the Modal close animation is over

    💣 Is this a breaking change (Yes/No):

    NO

    📝 Additional Information

    opened by ShumRain 3
  • Typescript: Duplication of @chakra-ui/system causes type errors

    Typescript: Duplication of @chakra-ui/system causes type errors

    Description

    Installing @chakra-ui/react and @chakra-ui/icons with npm installed two versions of @chakra-ui/system causing type errors

    Link to Reproduction

    https://codesandbox.io/s/interesting-violet-8xj25?file=/src/index.tsx

    Steps to reproduce

    This problem is reproducible using the steps below right now, but might not be if packages like @chakra-ui/skeleton is updated soon.

    1. Create brand new NPM project. (I think with npm v >=7, I used npm v8.3.1),

      mkdir dummy
      cd dummy
      npm init -y
      
    2. Install /icons and /react

      npm install @chakra-ui/[email protected] @chakra-ui/[email protected]
      
    3. Check versions of @chakra-ui/system

      npm ls @chakra-ui/system
      

      Check if the result contains more than one specific version of @chakra-ui/system, like for me right now I have both @chakra-ui/[email protected] and @chakra-ui/[email protected]

    Chakra UI Version

    @chakra-ui/[email protected]

    Browser

    No response

    Operating System

    • [ ] macOS
    • [X] Windows
    • [ ] Linux

    Additional Information

    I updated all dependencies by updating all dependencies in package.json and then deleting package-lock.json and reinstalling. And then I started getting type errors on every use of forwardRef().

    Type error: Type '{ ref: ForwardedRef<any>; slot?: string | undefined; style?: CSSProperties | undefined; title?: string | undefined; translate?: "yes" | "no" | undefined; ... 672 more ...; isInline?: boolean | undefined; }' is not assignable to type 'StackProps'.
      Types of property 'as' are incompatible.
        Type 'string | ComponentClass<any, any> | FunctionComponent<any> | ("symbol" & ComponentClass<any, any>) | ("symbol" & FunctionComponent<...>) | ... 699 more ... | (FunctionComponent<...> & ComponentClass<...>)' is not assignable to type 'As<any> | undefined'.
          Type 'string' is not assignable to type 'As<any> | undefined'.
    

    And I was also seeing the Expression produces a union type that is too complex to represent metioned in #3714 which was making it hard to debug.

    I figured it must be something with @chakra-ui/system that caused the issue, since the typing for forwardRef() is within that pacakge. I noticed that it had been updated as part of the process, but the changes between 1.9.0 and 1.9.1 didn't seem like they should cause type implosions. Knowing from previous typing problems, I suspected duplication and checked with npm ls @chakra-ui/system and sure enough, two versions was installed.

    As far as I can tell, the problem is caused by packages like @chakra-ui/skeleton specifying a very strict version as a dependency, while other packages specifies a very open >=1.0.0 as a peerDependencies.

    Since npm v7, npm installs peerDependencies by default, and is installing >=1.0.0 which resolves to 1.9.1, and then installs local versions for packages like @chakra-ui/skeleton to match their strict version.

    To work around this, you can either install with --legacy-peer-deps or add a npm overrides for @chakra-ui/system, like I specified on the stack overflow question for the union complexity.

    It's very possible that yarn does this in a better way, but from my memories with yarn, it also had lots of duplication issues.

    Type: Bug 🐛 needs triage 
    opened by oBusk 1
  • Support for SolidJS

    Support for SolidJS

    Description

    This feature request is intended to discuss for adding Chakra UI support for SolidJS and to know about the core team's opinions in this regard.

    Problem Statement/Justification

    Chakra UI has worked amazingly well for React web apps. SolidJS is an amazing framework that shares the same concepts and abstractions as React but is based on reactivity. For example, SolidJS also uses JSX and component model to build UI.

    Given the growth of SolidJS and the community's expanding interest in using Solid, I would like to propose adding support for SolidJS. I am available to help in bridging this amazing library for SolidJS.

    Proposed Solution or API

    Ideally, the APIs and components would be the same as those in Chakra UI React. However, those could be different if Solid's API impose any limitations.

    Alternatives

    No response

    Additional Information

    No response

    Type: Feature 🚀 
    opened by dmahajan980 0
  • Popover content position styles are only rendered after 1st click on popover trigger

    Popover content position styles are only rendered after 1st click on popover trigger

    Description

    When I render a popover content placed at the bottom I was expecting the position props to be rendered but they are only rendered after the first click on the popover.

    Link to Reproduction

    https://codesandbox.io/s/practical-hooks-t6jiv?file=/src/App.tsx

    Steps to reproduce

    1. Render this:
    <Popover arrowPadding={30} offset={[15, 15]} placement="bottom">
        <PopoverTrigger>
          <Box w="40px" h="40px">
            <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
              <circle cx="50" cy="50" r="50" />
            </svg>
          </Box>
        </PopoverTrigger>
        <PopoverContent borderRadius={12} border="none" p={2}>
          <PopoverArrow />
    
          <PopoverHeader fontSize="24" borderBottom="none">
            heading
          </PopoverHeader>
    
          <PopoverBody>Body</PopoverBody>
        </PopoverContent>
      </Popover>
    
    1. Inspect elements (see where the popover is being rendered before and after the 1st click).
    2. See Additional Information

    Obs: I tried to make a working example on CodeSandbox, but there was some error with the '@emotion/memoize' package that wasn't compiling.

    Chakra UI Version

    "@chakra-ui/react": "^1.7.1",

    Browser

    Same behavior on Chrome and Firefox (only ones I've tested)

    Operating System

    • [X] macOS
    • [ ] Windows
    • [ ] Linux

    Additional Information

    Before clicking on the popover for the 1st time:

    image

    image

    After 1st click (and subsequent clicks, opening and closing it).

    image

    image

    This is the popover that is being rendered:

    image

    I was expecting the position styles to be rendered right from the 1st render, regardless of it being clicked or not.

    Type: Bug 🐛 needs triage 
    opened by cbdeveloper 0
  • Custom toasts seem to be rendered twice

    Custom toasts seem to be rendered twice

    Description

    Custom toasts seem to be rendered twice.

    Link to Reproduction

    https://codesandbox.io/s/cool-roman-yvt8x?file=/src/index.tsx

    Steps to reproduce

    1. Go to https://codesandbox.io/s/cool-roman-yvt8x?file=/src/index.tsx
    2. Click on "Open Toast" multiple times. You should see this:

    image

    The counter increases two by two, instead of one by one. I have looked at Chakra-UI Toast source code but can't figure out why this is happening.

    Chakra UI Version

    1.7.4

    Browser

    No response

    Operating System

    • [ ] macOS
    • [ ] Windows
    • [ ] Linux

    Additional Information

    No response

    Type: Bug 🐛 needs triage 
    opened by lcswillems 10
  • [Chakra Storybook Addon] Color mode switch breaks visual testing tools

    [Chakra Storybook Addon] Color mode switch breaks visual testing tools

    Description

    When using visual testing tools that take screenshots of stories, the color mode switch appears in all of them, triggering a false positives.

    Link to Reproduction

    N/A

    Steps to reproduce

    No response

    Chakra UI Version

    @chakra-ui/[email protected]

    Browser

    No response

    Operating System

    • [ ] macOS
    • [ ] Windows
    • [ ] Linux

    Additional Information

    Some example: image

    Ideally, the color mode selector should at the toolbar, or at least would be great to have the option to disable the color mode switcher.

    Type: Bug 🐛 Topic: Storybook Addon 
    opened by guilleironhack 0
  • Variants on Text cause issue with ESLint and cannot build project

    Variants on Text cause issue with ESLint and cannot build project

    Description

    When creating a custom theme for the Text component, I except to be able to have variants but I have ESLint error informing me that this is not possible

    Link to Reproduction

    https://codesandbox.io/s/nervous-alex-uow1k

    Steps to reproduce

    1. Go to provided codesandbox demo
    2. Once the project is started go on index.tsx component
    3. The variant is correctly applied to the Text

    Chakra UI Version

    1.7.4

    Browser

    Brave 97

    Operating System

    • [X] macOS
    • [ ] Windows
    • [ ] Linux

    Additional Information

    Variants on the Text components causing an error when trying to build the project or deploying it on Vercel. The variants are correctly displayed on the screens (as showed in the codesandbox) but it's not possible to build the project (using next build).

    The error is the following: `Type error: Type 'string' is not assignable to type 'undefined'.``

    It's possible to fix the issue by using textStyles instead but this is not consistent with other components that all use variants (even the Heading component support variants).

    Type: Bug 🐛 workaround available ✌️ 
    opened by flavienbonvin 14
  • Version Packages

    Version Packages

    This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

    Releases

    @chakra-ui/[email protected]

    Minor Changes

    • #5316 1537a725f Thanks @TimKolberger! - Introducing semantic tokens

      Semantic tokens provide the ability to create css variables which can change with a CSS condition.

      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          900: "#171923",
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="gray.900">will always be gray.900</Text>
        </ChakraProvider>
      )
      
      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          50: "#F7FAFC",
          900: "#171923",
        },
        semanticTokens: {
          colors: {
            text: {
              default: "gray.900",
              _dark: "gray.50",
            },
          },
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="text">
            will be gray.900 in light mode and gray.50 in dark mode
          </Text>
        </ChakraProvider>
      )
      
      import { extendTheme } from "@chakra-ui/react"
      
      const theme = extendTheme({
        colors: {
          red: {
            100: "#ff0010",
            400: "#ff0040",
            500: "#ff0050",
            700: "#ff0070",
            800: "#ff0080",
          },
        },
        semanticTokens: {
          colors: {
            error: "red.500", // create a token alias
            success: "red.100",
            primary: {
              // set variable conditionally with pseudo selectors like `_dark` and `_light`
              // use `default` to define fallback value
              default: "red.500",
              _dark: "red.400",
            },
            secondary: {
              default: "red.800",
              _dark: "red.700",
            },
          },
        },
      })
      

    Patch Changes

    @chakra-ui/[email protected]

    Minor Changes

    • #5316 1537a725f Thanks @TimKolberger! - Introducing semantic tokens

      Semantic tokens provide the ability to create css variables which can change with a CSS condition.

      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          900: "#171923",
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="gray.900">will always be gray.900</Text>
        </ChakraProvider>
      )
      
      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          50: "#F7FAFC",
          900: "#171923",
        },
        semanticTokens: {
          colors: {
            text: {
              default: "gray.900",
              _dark: "gray.50",
            },
          },
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="text">
            will be gray.900 in light mode and gray.50 in dark mode
          </Text>
        </ChakraProvider>
      )
      
      import { extendTheme } from "@chakra-ui/react"
      
      const theme = extendTheme({
        colors: {
          red: {
            100: "#ff0010",
            400: "#ff0040",
            500: "#ff0050",
            700: "#ff0070",
            800: "#ff0080",
          },
        },
        semanticTokens: {
          colors: {
            error: "red.500", // create a token alias
            success: "red.100",
            primary: {
              // set variable conditionally with pseudo selectors like `_dark` and `_light`
              // use `default` to define fallback value
              default: "red.500",
              _dark: "red.400",
            },
            secondary: {
              default: "red.800",
              _dark: "red.700",
            },
          },
        },
      })
      
    • #5355 bb7eb18da Thanks @TimKolberger! - Export TypeScript types ResponsiveObject and ResponsiveArray

    Patch Changes

    @chakra-ui/[email protected]

    Minor Changes

    • #5316 1537a725f Thanks @TimKolberger! - Introducing semantic tokens

      Semantic tokens provide the ability to create css variables which can change with a CSS condition.

      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          900: "#171923",
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="gray.900">will always be gray.900</Text>
        </ChakraProvider>
      )
      
      import { ChakraProvider, extendTheme } from "@chakra-ui/react"
      
      const customTheme = extendTheme({
        colors: {
          50: "#F7FAFC",
          900: "#171923",
        },
        semanticTokens: {
          colors: {
            text: {
              default: "gray.900",
              _dark: "gray.50",
            },
          },
        },
      })
      
      const App = () => (
        <ChakraProvider theme={customTheme}>
          <Text color="text">
            will be gray.900 in light mode and gray.50 in dark mode
          </Text>
        </ChakraProvider>
      )
      
      import { extendTheme } from "@chakra-ui/react"
      
      const theme = extendTheme({
        colors: {
          red: {
            100: "#ff0010",
            400: "#ff0040",
            500: "#ff0050",
            700: "#ff0070",
            800: "#ff0080",
          },
        },
        semanticTokens: {
          colors: {
            error: "red.500", // create a token alias
            success: "red.100",
            primary: {
              // set variable conditionally with pseudo selectors like `_dark` and `_light`
              // use `default` to define fallback value
              default: "red.500",
              _dark: "red.400",
            },
            secondary: {
              default: "red.800",
              _dark: "red.700",
            },
          },
        },
      })
      

    Patch Changes

    @chakra-ui/[email protected]

    Minor Changes

    • #5316 1537a725f Thanks @TimKolberger! - Add helper function flatten

      import { flatten } from "@chakra-ui/utils"
      
      flatten({ space: [0, 1, 2, 4, 8, 16, 32] })
      /** =>
      {
        "space.0": 0,
        "space.1": 1,
        "space.2": 2,
        "space.3": 4,
        "space.4": 8,
        "space.5": 16,
        "space.6": 32,
      }
      */
      

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    [email protected]

    Patch Changes

    [email protected]

    Patch Changes

    [email protected]

    Patch Changes

    [email protected]

    Patch Changes

    @chakra-ui/[email protected]

    Patch Changes

    opened by github-actions[bot] 2
Releases(@chakra-ui/[email protected])
Owner
Chakra UI
UI components that make it super-easy to create websites and web apps with speed ⚡️
Chakra UI
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

Fluent UI Web Fluent UI web represents a collection of utilities, React components, and web components for building web applications. This repo is hom

Microsoft 12.7k Jan 15, 2022
Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

Fluent UI web represents a collection of utilities, React components, and web components for building web applications.

Microsoft 12.7k Jan 15, 2022
Syncfusion React UI components library offer more than 50+ cross-browser, responsive, and lightweight react UI controls for building modern web applications.

Syncfusion React UI components library offer more than 50+ cross-browser, responsive, and lightweight react UI controls for building modern web applications.

Syncfusion 206 Jan 17, 2022
Toolkit for building accessible rich web apps with React

Reakit Toolkit for building accessible rich web apps with React. Explore website » Sponsors By donating $100 or more you become a sponsor and help in

Reakit 5.4k Jan 15, 2022
EBS Design System - A React-based UI toolkit for enterprise grade applications

EBS Design System - A React-based UI toolkit for enterprise grade applications

EBS Integrator 250 Jan 11, 2022
An opinionated UI components library for React. Based on Styled Components and Styled System.

Insites UI Insites UI is an opinionated UI components library, powered by TypeScript, Styled Components and Styled System. It comes with source versio

Sodify 29 Nov 26, 2021
Interactive tour to help you build your first React app using Microsoft Graph Toolkit

Microsoft Graph Toolkit React code tour This repo contains an interactive tour to help you build your first React app using Microsoft Graph Toolkit -

Microsoft Graph 7 Dec 13, 2021
Package containing a few microinteractions you can use to reward your users for little things and make them smile!

Demo available here! Usage This package was built using React-Pose, react-dom-confetti and Lottie-web. Why should I use that? Read my blog post and yo

Jakub Szewczyk 979 Jan 19, 2022
Wholespace.github.io - A Simple Portfolio Built With React

Portfolio React Libraries used React-Router-Dom react-burger-menu Fonts used Pop

Naruhito Takei 2 Jan 7, 2022
Configurable React Components with great UX

Belle Configurable React Components with great UX. Website & Documentation: http://nikgraf.github.io/belle/ Getting Started Belle is available as npm

Nik Graf 2.5k Jan 17, 2022
🌈 React components that inspired by Microsoft's Fluent Design System.

Fluent-Windows React components that inspired by Microsoft's Fluent Design System. English | 简体中文 Installation Install the package in your project dir

Fluent-UI 119 Nov 7, 2021
A set of React UI components that supports Pinterest’s design language

Gestalt Gestalt is a set of React UI components that enforces Pinterest’s design language. We use it to streamline communication between designers and

Pinterest 3.9k Jan 21, 2022
React components of open-source Orbit design system by Kiwi.com

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products. Orbit Mission O

Kiwi.com 1.1k Jan 16, 2022
Bootstrap components built with React

React-Bootstrap Bootstrap 4 components built with React. Docs See the documentation with live editable examples and API documentation. To find the doc

react-bootstrap 20.4k Jan 19, 2022
Foundation as React components.

React + Foundation Foundation as React components. Demo https://digia.online/react-foundation-docs/ Components with Bit Motivation Foundation is both

Digia 593 Jan 7, 2022
:atom_symbol: React primitive UI components built with styled-system.

Rebass React primitive UI components built with Styled System. https://rebassjs.org npm i rebass Getting Started import React from 'react' import { Bo

Rebass 7.6k Jan 11, 2022
GraphQL API & React UI components for Elasticsearch. The easiest way to build a great search experience

Search, made easy Searchkit is an open source toolkit which helps you build a great search experience with Elasticsearch. Searchkit is a Graph QL / Re

Searchkit 4.4k Jan 11, 2022
React GUI-Framework based on Material UI; provides a couple of components for back-office apps (CRUD-based APIs)

Backoffice is a Framework based on Material UI, a Material Design React implementation that provides a couple of components you might want to use in a backoffice app.

React Backoffice 16 Jan 20, 2022
Elastic UI Framework is a collection of React UI components for quickly building user interfaces at Elastic🙌

The Elastic UI Framework is a collection of React UI components for quickly building user interfaces at Elastic. Not using React? No problem! You can still use the CSS behind each component.

elastic 3.3k Jan 13, 2022