.changelog/v2.mdx
Alert
Anatomy
Next.js
isExternal to typesStyled System
hueRotate and backdropHueRotate were not working.Toast
Tooltip
closeOnScroll is not setForm Control
Storybook Addon
Bumps Storybook deps to latest (7.5.3) and updates the tooling
useAddonState
api hook. However, this hook is not reliable to persistent allow toggling of
boolean state. Replaces this hook with React's useState as this state is a
primitive.makeDecorator function to make this addon more like an
official Storybook addon.Hooks
Menu
Tabs
Distored UI when device orientation or width is changed - On changing the device width and change of device orientation, the tab indicator element which is position absolute aligns realtive to the outer container element.
Hence, the position of immediate parent(tabs) is set to relative in this fix. This makes sure, if the orientation changes the tab indicator is aligned relative to its parent.
Theme
zIndex of DrawerOverlay creates incorrect stacking order
when multiple drawers are used.Modal
motionPreset prop in modal
componentCSS Reset, Icon, Theme, VisuallyHidden (potential breaking)
(POTENTIAL BREAKING CHANGE) Remove export defaults and favor of named exports.
- import theme from "@chakra-ui/theme"
+ import { theme } from "@chakra-ui/theme"
- import Icon from "@chakra-ui/icon"
+ import { Icon } from "@chakra-ui/icon"
- import CSSReset from "@chakra-ui/css-reset"
+ import { CSSReset } from "@chakra-ui/css-reset"
- import VisuallyHidden from "@chakra-ui/visually-hidden"
+ import { VisuallyHidden } from "@chakra-ui/visually-hidden"
Anatomy, Theme, Theme Tools
All components
"use client" directive.Avatar
Checkbox
Input
Fix InputElement and InputAddon sizing when using a responsive size
value for InputGroup.
Note: this requires changes in the latest @chakra-ui/theme or, for custom themes, sizes to be driven with CSS variables. See the default theme for an example.
Media Query
null value in useBreakpointValue hookMenu, Theme
MenuIcon as part of Menu themeNext.js
Switch
Storybook Addon
Improve build and exports
preview object containing the provider decorator.dts files for prodToast
Tooltip
Anatomy
group part to inputAnatomyMenuIcon as part of Menu themePopover
openDelay and closeDelay properties of Popover
componentTabs
Updates the UseTabOptions interface, potentially affecting code using
useTab() or <Tab /> components:
id, panelId, and isSelected.isFocusable which was being directly accessed and used, but
was not explicitly typed or documented.false for isDisabled and isFocusable. The
former was documented as defaulting to false, but both were defaulting to
undefined.Please review your codebase to ensure compatibility with these changes.
Theme
Move all Input size styles to CSS variables and apply them to both the
field part and the new group part so that said variables are available to
both the field and elements/addons within an InputGroup.
Revert getColorVar usage to getColor
React
Expose the skip nav components and types to the main package
import {
SkipNavLink,
type SkipNavLinkProps,
SkipNavContent,
type SkipNavContentProps,
} from "@chakra-ui/react"
Storybook Addon (BREAKING)
Accordion
DOM Utils
closeOnScroll doesn't work when tooltip trigger's scrolling
parent is not the root documentFocus Lock
focus-trap package to fix regression with return focus and initial
focus ref.Layout, React
Refactored the Stack and Wrap components to use the flex gap instead of
the owl selector & > * ~ * for spacing.
This fixes an issue where you can't use raw text nodes as a child of the
Stack or Wrap component.
Menu
Modal
modalManager and returns the index of the modal from useModal to
allow creating custom components similar to modalsPopover
Slider
Theme
xs and 2xs sizesTheme Tools
getColorVar function doesn't work when color is a functionTooltip
closeOnScroll doesn't work when tooltip trigger's scrolling
parent is not the root documentAll packages
11.11.x to support css cascade layersLayout, React
Add new Indicator layout component. Useful for positioning an element in the
corners of another element.
For example, let's say you want to position a notification badge in the top
end corner of a box. You can use the Indicator component to achieve this.
<Box position="relative" width="80px" height="80px" bg="gray.50">
<Indicator placement="top-end">
<Circle size="5" bg="red.100">
3
</Circle>
</Indicator>
</Box>
Next.js
isExternal to Link componentProvider
Add support for disabling global styles via the disableGlobalStyle prop on
the ChakraProvider.
This is useful for scenarios where user needs to scope all global styles + css reset to a specific element.
import { ChakraProvider } from "@chakra-ui/react"
function App() {
return (
<ChakraProvider disableGlobalStyle>
<App />
</ChakraProvider>
)
}
Theme
Add explicit color attribute on buttons to ensure consistency across light and dark modes.
**🚨 Potentially Breaking Change 🚨 **
If your button component code relies on inheriting color on buttons, consider adding an explicit color.
Avatar
Array.at refactoringAvatar
CLI
Popover
Slider
orientation is
undefined .Theme
showLastSeparator in the Stepper
componentPopover
shadowColor prop in the PopoverArrow component to change
the color of the arrow's shadow.Stepper
Add support for showLastSeparator in the Stepper component to show the
last separator in the Stepper component. By default, the last separator is
hidden.
Add default chakra-* classnames to all component parts.
Expose activeStepPercent, isCompleteStep, and isIncompleteStep to
useStep hook.
Add StepIndicatorContent component to reduce boilerplate for step indicator.
Avatar
Respect crossOrigin property in useImage
Fix issue where initials was not correctly computed when name includes a middle name like "Sage Naruto Manich"
Checkbox
Icons
SpinnerIcon id causes accessibility violationImage
crossOrigin property in useImageMenu
Next.js
next/image props were not forwarded to the underlying
component.Theme
isCentered is set to trueToast
useOutsideClick
Stepper
Introduce new Stepper component to model sequencial steps in a process.
<Stepper index={activeStep}>
{steps.map((step, index) => (
<Step key={index}>
<StepIndicator>
<StepStatus
complete={<StepIcon />}
incomplete={<StepNumber />}
active={<StepNumber />}
/>
</StepIndicator>
<Box>
<StepTitle>{step.title}</StepTitle>
<StepDescription>{step.description}</StepDescription>
</Box>
<StepSeparator />
</Step>
))}
</Stepper>
Editable
finalFocusRef and onBlur to Editable componentNext.js
@chakra-ui/next-js.Styled System
Add support for native aspectRatio style prop
<Box aspectRatio="16/9" />
Add support for nested semantic tokens in theme. It is now possible to declare semantic tokens by nesting objects.
BEFORE:
const theme = {
semanticTokens: {
colors: {
"background.pressed.base": { default: "blue.800", _dark: "blue.300" },
"background.pressed.subtle": { default: "blue.300", _dark: "blue.700" },
},
},
}
AFTER:
const theme = {
semanticTokens: {
colors: {
background: {
pressed: {
base: { default: "blue.800", _dark: "blue.300" },
subtle: { default: "blue.300", _dark: "blue.700" },
},
},
},
},
}
This allows for cleaner grouping and organization of tokens.
Add _horizontal and _vertical pseudo props to style orientation data
attributes
<Box _horizontal={{ width: "2px" }} _vertical={{ height: "4px" }} />
Theme
Gatsby Plugin
Reverts the use of the baseTheme in the plugin
With the added features of extendBaseTheme and ChakraBaseProvider, it was
determined that the provider is considered unnecessary.
Custom theming is to be expected for components when there are no defaults rendered.
For Gatsby, this means that the plugin can be reverted back to it's original
setup, and still be able to accept extendBaseTheme to reduce the payload of
the component themes when customizing them.
Styled System
Fix TS exhaustive issues with v5.0
Fix issue where <Box hideBelow="md" /> behavior was inconsistent with
<Hide below="md" /> component
CSS Reset
<input type="number" /> shows spinner buttonTheme
6.1.1Toast
Fix issue where zIndex was hardcoded in toast component by providing a css
variable --toast-z-index for better override experience.
You can set the toast's zIndex globally by setting a value for the
--toast-z-index. The default value for this variable is 5500
const theme = extendTheme({
styles: {
global: {
"--toast-z-index": 10,
},
},
})
Next.js
fill prop was not forwarded to the underlying component.Alert
data-status attribute to all alert component parts to allow for better
finegrained stylingStyled System
Add new defineCssVars helper to improve the experience of authoring a set of
css variables for a component theme.
import { defineCssVars } from "@chakra-ui/react"
// defines the `--badge-bg`, `--badge-border`, and `--badge-size` (with a 1rem fallback)
const vars = defineCssVars("badge", ["bg", "border", ["size", "1rem"]])
const style = {
bg: vars.bg.reference,
[vars.bg.variable]: "colors.red.500",
[vars.border.variable]: "colors.red.300",
}
Checkbox, Radio
preventDefault call in
pointer event on mobileNext.js
variant, size) could not be passed
to the Link componentTag
--badge-bg and
--badge-color css variables.Styled System
Creates the gradients theme key for props bgGradient, bgImage, bgImg,
and backgroundImage
This addition allows you to use tokens for the gradient values, semantic tokens included!
// gradients.ts
export const gradients = {
lightBgGradient:
"linear-gradient(102.7deg, #B9F1B9 0%, #5484EA 51.56%, #3A8E89 100%)",
}
// SomeComponent.tsx
<Box bgGradient='lightBgGradient' />
🚨 NOTE: The Background Gradient API can not be used in a token as the conversion is done when the api is used directly on a prop and not when compiling the theme config
Toast
colorScheme property in the useToast hookconst toast = useToast({
title: "Account created.",
description: "We've created your account for you.",
colorScheme: "blue",
})
Form Control
FormLabel where htmlFor and id could not be set to nullReact Context
createContext functionCSS Reset, Provider
Add support for scoping the css reset to specific selector.
To use this feature, pass the resetScope prop to the ChakraProvider or
ChakraBaseProvider component.
import { ChakraProvider } from "@chakra-ui/react"
function App() {
return (
<ChakraProvider resetScope=".ck-reset">
<App />
</ChakraProvider>
)
}
Next.js
Image component that supercharges the Next.js optimized image with
Chakra style props.import { Image } from "@chakra-ui/next-js"
function App() {
return (
<Image
src="/image.jpg"
alt="image"
width={500}
height={500}
objectFit="cover"
/>
)
}
createCache to avoid server-related errorsButton
loadingText to accept ReactNode instead of only stringCSSReset
--chakra-vh variable to :host as wellMenu
MenuProvider was not exportedAvatar
crossOrigin prop for imageEditable
useEditableContext hookStyled System
Add support for _firstLetter pseudo style props which translates to the css
select &::first-letter
<Text _firstLetter={{ fontSize: "80px" }}>Hello World</Text>
Styled System
hideFrom and hideBelow doesn't work as expectedAccordion
Fix regression where ExpandedIndex was no longer exported.
Note: this will be removed in future versions.
Avatar
max to 0 in AvatarGroup lead to unexpected
behavior.Menu
Menu schedules focus too frequently and leads to infinite
rerenders.Skeleton
SkeletonText component doesn't show its shimmer
animation.Styled System
parseGradient to make it works on legacy Firefox
browser.useClipboard
valueBreakpoint Utils
get method to breakpoint return to query details of a specific
breakpointInput
Added data-group attribute to InputGroup component.
This will allow uniform styling changes for Input, InputElement, and
InputAddon to occur when detecting state changes such as :hover and
:focus-within.
Example gif below with a left and right InputElement
Next.js Introducing a new Next.js integration package that provides a smoother experience when using Chakra UI in your Next.js 13 apps.
Note: This package is optional, you don't have to use it. It's just a convenience package aimed that improving developer experience with Next.js
This package provides 2 main features:
CacheProvider: This component composes the Emotion.js' cache provider with
the useServerInsertedHTML hook from next/navigation.
This is necessary to ensure that computed styles are included in the initial server payload (during streaming).
The use client directive is still required to be added to the top of the
page-related file. This is a limitation of CSS-in-JS libraries and Emotion for
now.
Note: Make sure to include the
<head>tag in your layout component otherwise it will not work.
// app/layout.tsx
"use client"
import { CacheProvider } from "Next-js"
import { ChakraProvider } from "React"
export default function RootLayout({
children,
}: {
children: React.ReactNode,
}) {
return (
<html lang="en">
<head />
<body>
<CacheProvider>
<ChakraProvider>{children}</ChakraProvider>
</CacheProvider>
</body>
</html>
)
}
Link: This component combines the functionality of the Next.js Link and
Chakra UI Link components.
// app/page.tsx
"use client"
import { Link } from "Next-js"
export default function Page() {
return (
<Link href="/about" color="blue.400" _hover={{ color: "blue.500" }}>
About
</Link>
)
}
Support for
next/imagecoming soon!
Styled System
Add hideFrom and hideBelow style props to styled system. This allows more
control over when to show/hide elements without requiring explicit
display: none every time.
<Box hideFrom="md">I will be hidden from md breakpoint up</Box>
<Box hideBelow="md">I will be hidden from md breakpoint down</Box>
Styled System
experimental_spaceX and
experimental_spaceYAll components
Focus Lock
react-focus-lock and VitestProvider
disableEnvironment option to disable the environment injected span. The
environment is used for automatic detection of the window and document.<ChakraProvider disableEnvironment>
<App />
</ChakraProvider>
Hooks
useDimensions uses stale value of node referenceIcons
ReactIcon was not exportedModal
react-remove-scroll, react-focus-lock and aria-hidden dependenciesStyled System
useBreakpointValue resolves to an incorrect value when
resizing the window in FirefoxSystem
Fixed issue where TS throws an error when using the translate style prop due
to clash with the native DOM translate attribute.
This was fixed by omitting the native translate attribute and introducing a
new htmlTranslate attribute for user who need this.
Toast
All components
Theme
Card theme to use component tokens. This makes it easier to
override styles from the base style.Icon
export * from 'src' statementsSystem
Fixed issue where style overrides does not respect order of precedence due to
the use of Object.assign.
To illustrate the issue, consider the following example:
const stylesFromTheme = {
px: 8,
padding: 0,
}
const stylesFromProps = {
px: 4,
}
const style = Object.assign({}, stylesFromTheme, stylesFromProps)
// Result: { px: 4, padding: 0 }
// Expected: { padding: 0, px: 4 }
The issue is that Object.assign will replace properties in place with values
from the override objects. This is not the desired behavior for style
overrides hence a custom assignAfter function is used instead
All components
Checkbox, Radio
@zag-js/* dependencies to latest versions for better ESM
compatibilityInput
InputGroup isolates its stacking context to prevent z-index clashesTheme Tools
lighten and darken functions in theme toolsSystem
styled default export.Storybook addon
All components Improved the build setup for all packages.
latest version of tsup for automatic JSX runtime detectiontsup config to package.json.mjs file extension for correct module loadingCard
CardFooter style could not be overriden from theme.CLI
Skeleton
Skeleton styles could not be overidden in dark modeSlider
RangeSliderState and RangeSliderActions types to improve
documentationStyled System
isTruncated to solve some edge cases with noOfLines={1}Table
layout prop to set the tableLayout CSS property.Icons
ReactIcon to align with Figma UI KitGatsby Plugin
ChakraBaseProvider instead of ChakraProvider2. This
will only apply theme tokens only and exlude theming for components.Skeleton
Added support for fitContent prop.
When set to true, the Skeleton will take the width of its children.
<Skeleton fitContent>
<p>Hello World</p>
</Skeleton>
All components
defaultProps from components to support React 18.3.0Modal
PortalsProgress
aria-valuetext property was not set on the correct elementCard
createStylesContext from @chakra-ui/systemGatsby Plugin
Slider
SliderActions and SliderState types to improve documentationTheme
Tabs when using the enclosed variant.baseTheme object with includes only the theme tokens.React Types
Button
Added support for orientation prop in the ButtonGroup component.
This makes it possible to now have vertical button groups when isAttached is
set to true.
<ButtonGroup isAttached orientation="vertical">
<Button>Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
<Button>Button 4</Button>
</ButtonGroup>
CLI
Add the flag --strict-token-types for @chakra-ui/cli tokens to generate
strict types for theme tokens (e.g. color, spacing)
chakra-cli tokens --strict-token-types
// before
<Box padding="abc" />
// valid type, but "abc" is not available in the theme
// after
<Box padding="abc" /> // invalid
// Type '"abc"' is not assignable to type '"1" | "2" | ... | undefined'.
Icon
Added support for styling the Icon component from the theme object.
const theme = extendTheme({
components: {
Icon: {
width: "auto",
},
},
})
Menu
Added support for setting the initially focused menu programmatically using
initialFocusRef.
const Example = () => {
const itemRef = useRef(null)
return (
<Menu initialFocusRef={itemRef}>
<MenuButton>Welcome</MenuButton>
<MenuList>
<MenuItem>Menu 1</MenuItem>
<MenuItem ref={itemRef}>Menu 2</MenuItem>
<MenuItem>Menu 3</MenuItem>
</MenuList>
</Menu>
)
}
React
Add ChakraBaseProvider, a minimal version of ChakraProvider that supplies
just the theme tokens, and ignores components.
Historically, one of the biggest causes of the large initial JS payload is the
size of the component themes. With this approach, you get to apply the theme
for just the component you need by using extendBaseTheme.
Base theme refers to the minimal theme for just the design tokens
import { ChakraBaseProvider, extendBaseTheme } from "@chakra-ui/react"
import { Button } from "@chakra-ui/theme/components"
const theme = extendBaseTheme({
components: {
Button,
},
})
function App() {
return (
<ChakraBaseProvider theme={theme}>
<Component {...pageProps} />
</ChakraBaseProvider>
)
}
Styled System
textIndent style propRadio
value and defaultValue to string instead of
string | number. This reflects the internal implementationTheme Utilities
tinycolor package with color2k for smaller bundle sizeCard
React is not defined issue when importing Card component.Theme
All packages
@chakra-ui/react or any sub-package in a TypeScript
project with "type": "module" in package.json and
"moduleResolution": "Node16" in tsconfig.json cannot find the types.Tooltip
Fixed issue where dynamically changing a tooltip's isDisabled when it is
open didn't have any effect.
Now, changing the isDisabled prop will close the tooltip leading to a more
consistent behavior.
Card
Card componentexport function Basic() {
return (
<Card>
<CardHeader>
<Heading size="md"> Customer dashboard</Heading>
</CardHeader>
<CardBody>
<Text>View a summary of all your customers over the last month.</Text>
</CardBody>
<CardFooter>
<Button>View here</Button>
</CardFooter>
</Card>
)
}
System
Dict type dependency from createStyleContextTheme
Editable
onSubmit was called twice when input is blurred with enter
key.Hooks, UseFocusEffect
Progress
title prop was not passed to the
underlying role=progress element.Progress
Added support for overriding the role for Progress eleement. This makes it
possible to use the progress as a meter element.
<Progress size="sm" value={20} role="meter" aria-label="Usage" />
Checkbox
framer-motion with native css animationCSS Reset
Use dvh unit if supported
This allows the user agent to dynamically adapt the height of a Modal, depending on what parts of the UI (e.g. address bar) are visible.
Theme
mode runtime function with CSS variables where possible.Visually Hidden
0px -> 0Editable
Modal
useInert doesn't work consistently between the Drawer and
ModalProgress
Progress and ProgressFilledTrack)
did not use forwardRefToast
containerStyles to accept style props, not just React CSS propertiesrender optionsTransition
Children Utilities
peerDependencyAvatar
Added support for styling the AvatarGroup from the theme by adding the
group part.
const theme = extendTheme({
components: {
Avatar: {
baseStyle: {
group: {
// styles for the AvatarGroup
},
},
},
},
})
Breadcrumb
listProps to allow passing props to underlying ol elementCheckbox
Hooks
setValue as function exposed by useClipboard to enable control over
the value after first initializationSystem
Theme
Theme Utilities
extendTheme utilities to a dedicated package
(@chakra-ui/theme-utils)All components
@chakra-ui/styled-system dependency issueAccordion
allowMultiple warning conditionAvatar
Breadcrumb
NumberInput
Slider
Styled System
[disabled] selector on top of :disabledTheme
UsePanEvent
usePanEvent to account for the correct dependency list changesDOM Utilities
[disabled] attribute selectorTooltip
closeOnScroll prop to allow closing tooltip when the page or overflow
container scrolls.Modal
containerProps to drawer componentStorybook Addon
Allow setting the storybook chakra theme via a callback function, with access to the context
Allow getThemingArgTypes to return args when colorScheme is not supported
by component
UseLatestRef
useLatestRef hookEditable
NumberInput
Fix issue where input spins unexpectedly on right clicking the increment or decrement button with a pointer.
Now, only left click (or primary button) will trigger a value change.
Styled System
console.logAll components
Added missing component/function docs and relative docsite links.
Ensures that all Components, functions, and hooks that have detailed pages on the Chakra site have corresponding TS Docs and links back to the docsite via IDE intellisense.
Includes adding or fixing links within these docs to related WAI-ARIA patterns.
DOM Utilities
:disabled, instead of
[disabled] attribute selector. This is useful when an editable element is
wrapped within <fieldset disabled> Menu, TableTheme
--tooltip-fg css variable was incorrectly appliedLayout
Fixed an issue where Highlight showed key warnings
Prevent Stack from crashing when there's a lot of child elements
NB: This does not help improve loading and refresh performance otherwise, libraries like
react-virtualizedshould be used to handle large lists.
PinInput
Styled System
Revert #6335 to fix issue where lots of responsive styles makes app slower
Update disabled selector to use state selector :disabled, instead of
[disabled] attribute selector. This is useful when an editable element is
wrapped within <fieldset disabled>
Improve style resolution when components are wrapped within forced color mode
elements (DarkMode, LightMode).
We now dynamically attach the data-theme attribute to chakra elements when
in forced color mode.
<DarkMode>
<chakra.div bg="gray.800" padding="40px">
<Badge>Total</Badge>
</chakra.div>
</DarkMode>
Tag
forwardRef with TagCloseButtonTheme
xs sizingTooltip
shouldWrapChildren). This was fixed by switching from mouse events to
pointer eventsUseControllableState
UseFocusOnPointerDown
All components
framer-motion elements via the motionProps prop.Color Mode
nonce back to ColorModeScriptPopover
Theme
--tooltip-fg css variable was incorrectly appliedCSS Reset
100vh polyfillMenu
Styled System
Allow user optin to the 100vh polyfill because it's only useful in absolute
or fixed layout modes.
Chakra now polyfills the 100vh attribute to use either the literal 100vh
or -webkit-fill-available where supported. To use this feature, set the
height values to $100vh instead of 100vh.
// Might not work in all cases
<Box minHeight="100vh" position="absolute">
Test
</Box>
// Polyfilled version ensures 100vh work correctly
<Box minHeight="$100vh" position="absolute">
Test
</Box>
Slider
Descendants
Select
field part is not definedTabs
Toast
Event Utilities
addPointerEvent utilityGatsby Plugin
Avatar
Added support for changing avatar badge placement. The badge placement can be
set to top-start, top-end, bottom-start or bottom-end.
<Avatar
name="Uchiha Itachi"
src="https://uinames.com/api/photos/female/18.jpg"
>
<AvatarBadge placement="top-start" />
</Avatar>
Styled System
Added defineStyle and defineStyleConfig to improve the TypeScript
authoring experience of style objects and single part component themes.
import { defineStyleConfig, defineStyle } from "@chakra-ui/styled-system"
// authoring style objects
const style = defineStyle({
marginTop: "20px",
})
// authoring style configs for single part component
const button = defineStyleConfig({
baseStyle: {},
variants: {},
defaultProps: {},
})
Added createMultiStyleConfigHelpers factory that provides functions that
help improve the TypeScript authoring experience of multipart component
themes.
import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-sytem"
// create scoped helpers for that defined parts
const helpers = createMultiStyleConfigHelpers(["button", "label"])
const { definePartsStyle, defineMultiStyleConfig } = helpers
// authoring styles for each part
const outlineVariant = definePartsStyle({
button: {},
label: {},
})
// authoring styles for multipart component
const accordion = defineMultiStyleConfig({
baseStyle: {
button: {},
label: {},
},
variants: {
outline: outlineVariant,
},
})
All components
100vh values by using a polyfill css variable
--chakra-vh.Anatomy
Skeleton, Theme
styled-system packageTheme
Theme Tools
styled-system packageCounter
min and max prop in TS docsTabs
All components
Tooltip
Color Mode
localStorageManager was not exportedCLI
ThemeTypings created by chakra-cli could not be usedReact Env
id and hidden attributes to the rendered env spanStorybook Addon
Styled System
Improve style computation performance by looping over styles once. Previously, we had two steps in the logic (expand responsive and convert to css object). This can be quite expensive with large css objects (or style props).
We now process both steps in a single pass.
Fixed regression where ThemeTypings created by chakra-cli could not be used
Escape symbols in css variable to make it work
Theme
FormHelperText to satisfy accessibility checkTheme Utilities
StyleFunctionProps type was not exportedUtilities
isBrowser to tree-shake when bundlingAll components
Hooks
useDimensions in favor of the useSize hookReact
ChakraProvider.defaultProps and move logic inside the component.Layout
key in Highlight component to avoid React warningsHighlight to not show any highlights if query is emptyTheme
exports in the package.jsonAll packages
main and module entries on most packagesColor Mode, React Env
Media Query
getClosestValue to return nullable closest break point valuePortal
Portal doesn't render childrenStyled System
All components
useStyles equivalent for multipart component styles. Accordion
exports useAccordionStyles, Alert exports useAlertStyles, and so on.SuspenseCLI
Image, Popover
displayName and forwardRef to componentsPopover
hover.Transition
framer-motion releaseUtilities
TypeError in getCSSVar when the theme is an empty objectgetFocusables causes excessive repaint due to computed
style callsLayout
Added new Highlight component to emphasize any part of a string with the
mark tag.
<Text fontWeight="semibold">
<Highlight
query={"with speed"}
styles={{ px: "2", py: "1", rounded: "full", bg: "teal.100" }}
>
Create accessible React apps with speed
</Highlight>
</Text>
Theme
Checkbox
CLI
lodash.throttle dependencyDescendant
useDescendants hook for improved TypeScript 4.8
supportLayout, SimpleGrid
minChildWidth doesn't work with size tokensRadio
Theme Utilities
createBreakpoints functionTooltip
Color Mode
MediaQueryList object supports the addEventListener() method,
else fallback to the legacy .addListener() method.CLI
--no-format optionModal
useDrawerContext hookSkeleton
fadeDuration propSystem
getToken function from useTokenuseTokenToast
@chakra-ui/system to peer dependencySystem
useStyles and StylesProvider was removed from
@chakra-ui/systemToast
portalProps in toast provider. When using with the
ChakraProvider, this can be configure in the toastOptionsAll components
createStylesContext function.Checkbox
data-focus-visible to getCheckboxPropsCheckbox, Theme
CLI
SyntaxError: Undefined label 'e'.Modal
Radio
CLI
New --watch flag for the tokens command. You can specify a directory path to
watch for changes.
It defaults to the parent dir of <source>, e.g. src/theme/theme.ts =>
src/theme.
> chakra-cli tokens src/theme/theme.ts --watch
> chakra-cli tokens --help
Usage: chakra-cli tokens [options] <source>
Options:
--out <path> output file e.g. node_modules/@chakra-ui/styled-system/dist/declarations/src/theming.types.d.ts
--strict-component-types Generate strict types for props variant and size
--watch [path] Watch directory for changes and rebuild
-h, --help display help for command
Media Query
Add support for client-side rendered (CSR) apps to get the correct value on first render.
Affected hooks:
useMediaQuery,useBreakpoint,useBreakpointValue.
These hooks are built work in server-side rendering (SSR) applications by default. You might notice a quick flash of incorrect media query value when you use them.
If you're creating a CSR-only app, you can now leverage the ssr argument to
get the correct value on first render.
const [isMobile] = useMediaQuery("(max-width: 768px)", {
// you can now pass `ssr: false`
ssr: false,
})
const buttonSize = useBreakpointValue(
{ base: "sm", lg: "md" },
// you can now pass `ssr: false`
{ ssr: false },
)
// you can now pass `ssr: false`
const breakpoint = useBreakpoint({ ssr: false })
Styled System
data-focus-visible using the _focusVisible pseudo
propAll components
Migrate components to use _focusVisible instead of _focus selectors to
indicate focus.
🚨 NOTE: This might be a potential breaking change for consumers who use the
extendThemewith the_focusstyles. Kindly migrate to_focusVisible.
Toast
use-sync-external-store due to lack of
getServerSnapshotAll components
@default value for prop typesReact
Styled System, System
!important can resolve to a double !important
being addedSystem
useStyleConfigTab, Theme
Toast
createStandaloneToastUtilities
toMediaQuery function to handle null and undefined valuesAll components
src directory is not referenced in the emitted type declarations.Media Query
Textarea
Theme
Toast
bottom as
described in docsAvatar, Image
referrerPolicy propStyled System
Add support for responsive variants and sizes
<Button variant={["sm", "lg"]}>Click me</Button>
Add support for !important in token values as an escape hatch for overriding
properties in responsive variants/sizes.
<Button variant={["sm", "lg"]} fontSize="lg !important">
Click me
</Button>
Notes
colorScheme since it is technically not a variantFocus Lock
react-focus-lock to be compatible with React 18Color Mode
Checkbox
Color Mode
Improve SSR for color mode by adding manager.get() in the default state
Add support disableTransitionOnChange option in ColorModeProvider and
theme.config to control whether the transition of all elements should be
temporarily disabled while the color mode changes.
Expose cookieStorageManagerSSR for users who prefer to manage color mode
server-side. If you use this, there's no need for the ColorModeScript
function App({ Component, pageProps }) {
// get the `cookie` from each page `getServerSideProps` return value
// Note: the implementation is up to you
const manager = cookieStorageManagerSSR(pageProps.cookie)
return (
<ChakraProvider manager={manager}>
<Component />
</ChakraProvider>
)
}
We now provide a way to customize the localStorage / cookie storage key
import { createLocalStorageManager } from "@chakra-ui/react"
const manager = createLocalStorageManager("my-key")
// in root
function App() {
return <ChakraProvider colorModeManager={manager} />
}
// in script
function Document() {
return <ColorModeScript storageKey="my-key" />
}
Fix inconsistent handling across provider and script
Theme
solid