Skip to content

Content

Flip

Bundle size
2.28 KB
3.0.1

Flips an element, revealing its hidden face.

This is an original component from Inpulse.

It can be used to create smooth transition effects and animations.

Terminal window
pnpm add @inpulse-ui/flip

Contains all the flip component parts.

PropTypeDefault ValueRequired
defaultToggledbooleanfalseNo
onChangefunction-No
toggledbooleanfalseNo

Wraps the content that will be flipped.

PropTypeDefault ValueRequired
axis

enum

No
reversebooleanfalseNo
useHoverbooleanfalseNo

The button that activates the flip effect.

PropTypeDefault ValueRequired
asChildbooleanfalseNo

Wrap all flip component parts with the Flip component. The FlipContent contains both the FlipFront and FlipBack sides. Use the FlipTrigger to activate the flip effect when clicked.

<Flip>
<FlipContent>
<FlipFront>Front</FlipFront>
<FlipBack>Back</FlipBack>
</FlipContent>
<FlipTrigger>Toggle</FlipTrigger>
</Flip>

It is recommended to apply shared styles between both the front and back sides directly to the FlipContent component using the className property, to avoid code duplication, ensure consistency and improve the animation.

Use the FlipTrigger component to activate the flip effect. The contents of the back will be displayed when the button is pressed.

Apply the useHover property to activate the flip effect when hovering over the element. The back side content will be displayed while the mouse is over the FlipContent. Note that this behavior only works on desktop devices. Ensure there is another method to allow back-side content to be viewed on mobile devices.

Be careful when using the useHover property, as it may not work as expected on touch devices.

If you want to reverse the direction of the flip effect, add the reverse property to the Flip component. This property has an effect on both horizontal and vertical orientation.

By default, the flip effect will be applied horizontally. To apply the effect vertically, add the axis property to the Flip component, with the value y.

To have the back side content displayed by default, add the defaultToggled property to the Flip component.

Use the onChange event to perform an action every time the Flip component is toggled.

Project

Built with by Jo Santana in Brazil.

© 2026 Inpulse. All rights reserved.