--- title: Animation description: Using CSS animations to animate Chakra UI components --- We recommend using CSS animations to animate your Chakra UI components. This approach is performant, straightforward and provides a lot of flexibility. You can animate both the mounting and unmounting phases of your components with better control. ## Enter animation When a disclosure component (popover, dialog) is open, the `data-state` attribute is set to `open`. This maps to `data-state=open` and can be styled with `_open` pseudo prop. ```tsx This is open ``` Here's an example that uses keyframes to create a fade-in animation: ```css @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } ``` ## Exit animation When a disclosure component (popover, dialog) is closed, the `data-state` attribute is set to `closed`. This maps to `data-state=closed` and can be styled with `_closed` pseudo prop. ```tsx This is closed ``` Here's an example that uses keyframes to create a fade-out animation: ```css @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } ``` ## Composing animations Use the `animationName` prop to compose multiple animations together. This makes it easy to create complex animations with multiple keyframes. ```tsx This is a composed animation ```