Getting Started
Installation
npx shadcn@latest add https://tentui.com/r/liquid-metal-border.json
Usage
LiquidMetalBorder is a wrapper <div> that accepts an inner contentClassName.
import { LiquidMetalBorder } from "@/components/liquid-metal-border";
export function LiquidMetalCard() {
return (
<LiquidMetalBorder
borderWidth={4}
borderRadius={16}
contentClassName="bg-card p-4"
>
<div>
<h3>Animated Border</h3>
<p>A shader-driven border around the element.</p>
</div>
</LiquidMetalBorder>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
borderWidth | number | 2 | Width of the liquid metal border. |
borderRadius | number | 16 | Outer border radius of the wrapper. |
contentClassName | string | — | Class applied to the inner content layer. |
speed | number | 0.6 | Animation speed of the shader effect. |
repetition | number | 4 | Number of pattern repetitions. |
softness | number | 0.5 | Softness of the metallic highlights. |
shiftRed | number | 0.3 | Red color shift amount. |
shiftBlue | number | 0.3 | Blue color shift amount. |
distortion | number | 0 | Distortion amount applied to the pattern. |
contour | number | 0 | Contour intensity. |
angle | number | 45 | Angle of the shader pattern in degrees. |
scale | number | 8 | Scale of the shader pattern. |
offsetX | number | 0.1 | Horizontal offset of the pattern. |
offsetY | number | -0.1 | Vertical offset of the pattern. |
All standard <div> props (className, style, onClick, etc.) are applied to the outer container.
How it works
The component consists of a padding-based parent container that holds an absolute background and a relative foreground element.
- Shader layer.
LiquidMetalcomponent from@paper-design/shaders-reactis rendered as the absolute background of the parent div. - Padding border. The border's visual thickness is controlled by the outer div's inline
paddingvalue, revealing the shader beneath the content area. - Inner layer. The inner layer holds the children with an appropriate inner
borderRadiusformula calculated dynamically.