I want to create a hover state for a tertiary link button. The button text will be "learn more" and before that text there will be a small black box, with an arrow inside of it pointing right. On hover, make the arrow slide out to the right, and then come back in on the left, almost like using the black box as a mask
I'll create a tertiary link button with the animated arrow effect you described. The black box will act as a mask, and on hover, the arrow will slide out to the right and reappear from the left.
The Button Structure:
ArrowRight icon for the arrowThe Animation:
overflow: hidden to create the mask effectImplementation Details:
You can customize the animation speed by adjusting the duration-300 class to a different value, or change the colors by modifying the background and text color classes.
Can you make the black box have slightly rounded corners?
I'll update the black box to have slightly more rounded corners.
I've updated the black box to have slightly more rounded corners by changing the rounded-sm class to rounded-md. This provides a more noticeable but still subtle rounding effect that softens the appearance of the black box while maintaining its clean look.
If you'd prefer even more rounded corners, you could use:
rounded-lg for larger rounded cornersrounded-xl for very rounded cornersrounded-full for completely round corners (would make it circular in this case)