@gfazioli/mantine-reflection
A Mantine component that adds a reflection effect to its children.
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-reflection
by importing @gfazioli/mantine-reflection/styles.layer.css
file.
Usage
The Reflection
component simply wraps the content to be reflected.
Reflection Blur: The
Reflection
component has areflectionBlur
prop that can be used to add a blur effect to the reflection. The value is a number that represents the amount of blur in pixels. The default value is0
. You will probably notice that in the image above, as the blur effect on the reflection increases, the edges of the image will be cut off. To avoid this problem, you can adjust the blur effect with low values or apply padding to the component/image to be reflected.
The Image tag
The img
tag requires to be in display: block
in order to avoid padding below it. For this reason, a style
has been added to force the behavior.
Components
You may use the Reflection
component to reflect other components.
Complex components
For complex components, you may need to disable certain components to prevent the mirrored version from functioning as a copy. In this example, we used the prop disableChildren
for the right component. Mouse click is always disabled via CSS, but moving with the TAB key will focus on the mirrored component.