Tips for reproducing the line order seen in the image within a React component

Whenever I hover over No.1(text), my goal is to trigger an animation that starts with No. 2 and continues onwards.

https://i.sstatic.net/g0lNk.png

This code belongs to me.

<span ohMouseOver={() => setMenu("design"} className="design">
 ARCHITECTRURE DESIGN
</span>

Any suggestions on how to achieve this? Thank you

Answer №1

An effective method is using an SVG <path> element and implementing hover animations with stroke-dasharray and stroke-dashoffset

a {
  position: relative;
}

a svg {
  pointer-events: none;
  position: absolute;
  left: 100%;
  bottom: 0;
}

a path {
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  transition: stroke-dashoffset 1s linear;
}

a:hover path {
  stroke-dashoffset: 0;
}
<p>spacer</p>

<a href="#">
hover over me
<svg width="200" viewBox="0 0 200 70">
  <path fill="white" stroke="black" stroke-width="4" d="M10,65h50v-50h50"/>
</svg>
</a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilize props to render a simple table in React using Typescript, Axios, hooks, and Material-UI with a basic table layout

Currently, I am tackling multiple learning tasks simultaneously which has caused me to stumble on a specific problem. After successfully setting up the basic template structure with placeholder data and ensuring my API call is functional, I encountered an ...

Prevent the bootstrap header in a table from scrolling by enclosing it in

I am encountering an issue with fixing the headers of multiple tables in a page within their dedicated divs. Despite trying various methods, I haven't been successful as the fixed header overflows the div. I want to confine it within the div. Additio ...

Inquiring about react-hook-form: why does getValues not retrieve the latest value?

I am facing an issue with my radio buttons labeled A, B, and C. Specifically, under button B, there is a select box that I want to make 'required' only when B is selected. Below is the simplified code snippet: interface ButtonFormType { not ...

What is the best way to make a div stick to the inside of another div with Bootstrap?

As a newcomer to Bootstrap 4, I am curious if there is a way to affix a div to the bottom of its parent div. My structure involves using the classes .container within a .row, along with several child divs: <div class='container'> <d ...

What could be the reason behind the improper display of JavaScript for ID overlay2?

Why is it that when I try to have two overlays with different messages display upon clicking buttons, they both end up showing the same message? Even after changing the ID tag names, the issue persists. Can someone shed some light on what might be causin ...

Ways to utilize/extract data from an enumeration

Hello there! I am currently diving into the world of React and Typescript, eager to expand my knowledge. Please bear with me if my explanations are not up to par. In my react app, I have a scenario where I created an enum that I want to utilize in two diff ...

Managing numerous invocations of an asynchronous function

I have an imported component that triggers a function every time the user interacts with it, such as pressing a button. Within this function, I need to fetch data asynchronously. I want the function calls to run asynchronously, meaning each call will wait ...

Customizing HTML forms using WordPress Divi's custom CSS techniques

I have a WordPress website that I'm customizing with the Divi theme. I've successfully added an HTML form to a 'Code' module and it's functioning well. However, I am struggling to determine where I should place the CSS code. I&apos ...

Utilizing a generic type with the useReducer hook for an output parameter

I am currently working on developing a custom hook to retrieve data from an API. My main goal is to ensure that the returned data maintains type safety. Is it possible to achieve this using generics? type Action = { type: 'PENDING' } | { type: &a ...

Modifying a leave transition in Vue.js dynamically following the completion of an enter transition

I am dealing with a dynamic transition for a slider element that moves left or right. Vue only allows me to have one transition, so I am using a dynamic transition property like this: <transition v-bind:name="'slider-' + slideDirection"> ...

Adding a caption aligned to the right edge of an image in Wordpress

Any suggestions on aligning an image caption under an image tag to its right hand edge? I attempted using a div, but it seems it's not allowed in WordPress. Can anyone recommend alternative CSS or tags that I could use for this purpose? ...

Solutions for Troubles with Material UI SVG

I am facing issues with SVG Icons from the Material UI Framework. The problem I am encountering is that the icons are not rendering properly. Here is a simple example: <FloatingActionButton onTouchTap={this.handleToggle} style={menuIconStyle}> < ...

Transform Vue.js into static HTML output

Is there a way to convert a Vue.js component into static html without the need for javascript? I am specifically interested in retaining styles. I am searching for a library where I can execute code similar to this: SomeNestedComponent.vue <template> ...

I am interested in showcasing a distinct screen layout specifically designed for mobile device viewing

Looking to display different screens for PC and smartphone users. I am using react, Typescript, and next.js for development. Specifically, I need to show user.tsx when accessing the /user URL from a PC, and Accessdenied.tsx when accessing it from a smartp ...

Arrange and display similar objects together

I have a list of items in a listView that need to be visually grouped based on their class, displayed within boxes. For example, I have 5 items with the following classes: <div class="1"></div> <div class="1"></div> <div class= ...

Identification of inappropriate language in usernames

One of the challenges I'm facing is detecting inappropriate language in usernames. Currently, I am using regex to validate the username based on a specific pattern: "/^[A-Za-z0-9]*(\d*\.\d*)*[A-Za-z0-9]+$/" This regex pattern allows u ...

Avoiding 0 being mistakenly interpreted as undefined while utilizing React Conditional Rendering

I have a React component with the following code in its render function: return ( <div> {rating.score && ( <div>do something</div> )} </div> ); The prop rating.score is of type PropTypes.number. Eve ...

Transferring information from a function-based module to a higher-level class component in React Native

I'm currently working on an application that has a tab navigation. One of the screens in the tab is called "ScanScreen," where I'm trying to scan a UPC number and send it to the "HomeScreen" tab, where there's a search bar. The goal is for t ...

I am interested in combining Bootstrap classes with Next.js modules in an inline manner

https://i.sstatic.net/tOTCu.png Is it possible to seamlessly integrate bootstrap classes and custom styles in next.js modules? How can this be achieved? https://i.sstatic.net/ELs3O.png ...

What are some techniques for ensuring a CSS div remains stable and intact when adjusting the browser size?

Is there a way to prevent the entire website from resizing when you minimize or maximize your browser? I want the website size to adjust in proportion to your resize without reorganizing everything. How can this be achieved while maintaining the site lengt ...