Gradient Card
Add animated borders to your cards
Use the GradientCard
component to add an animated gradient border to your cards to increase their visibility, and highlight important content on your page, such as featured products, special offers, promotions, top-rated items, or new releases.
Gradient Card with animated border
The API of the GradientCard
component matches the API of the Card
component, meaning you can use any valid card prop with your GradientCard
component. In the above example, both the title
and secondary
props are specific to the Card
component. The GradientCard
is only responsible for adding an animated border to your card that can be further configured with additional props.
Border Size
You can customize the size of the border by specifying the border
prop on the component:
Gradient Card with increased border
Animation Timing
The border does one rotation every five seconds. This animation timing can be refined using the animationTime
prop:
Gradient Card with 1s animation time
Custom Colors
The component uses a mixture of blue and purple colors by default. You can easily change this to suit your brand colors by specifying the startColor
and endColor
props on the card:
Gradient Card with custom colors
Configure Blur
Similar to colors, you can customize the blur and spread amount of the border, using the blurAmount
and scaleAmount
props:
Gradient Card with custom blur
Gradient Card with custom scale
Customize with CSS
The above props can be used to customize the appearance of your GradientCard
components on an individual basis. However, if you need custom styles for all of your GradientCard
components, the recommended way is to override the following CSS variables once, and remove any GradientCard
-specific props from your code:
API
Card
component for the CardProps
type. Prop | Default | Purpose |
---|---|---|
border | 2px | Sets the width of the animated border. |
animationTime | 5s | Sets the animation time. |
startColor | #1CAED7 | Sets the start color of the animation. |
endColor | #4E00C2 | Sets the end color of the animation. |
blurAmount | 75px | Sets the blur amount of the border. |
scaleAmount | .8 | Sets the spread of the border. |
className | - | Pass additional CSS classes for the card. |
Request improvement for this page