Start with the basic structure of the component.
To implement the glowing border effect, I used the conic-gradient
CSS property.
background: conic-gradient(
from 10deg,
transparent 20%,
#4eaffe 50%,
transparent 20%
);
The from 10deg
is the starting angle of the gradient. The transparent 20%
is the color of the transparent part of the gradient. The #4EAFFE 50%
is the color of the part of the gradient that is not transparent. The transparent 20%
is the color of the transparent part of the gradient.
And the width: 200%
and height: 200%
class is used to make the gradient larger than the container.
We need to hide the overflowing part of the gradient by using the position: relative
for the main icon container.
Then we need to add the spinning animation to the gradient. And for this, we need to use the animate-spin
class. (animation from Tailwind CSS Animations) on the before
pseudo-element.
before: animate-spin;
or you can use the @keyframes
rule to animate the gradient.
@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
Finally, we got the glowing border effect.