screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script> <script src="https://unpkg.com/@babel/standalone@7.14.7/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useState } = React; function App() { const [isHovered, setIsHovered] = useState(false); const handleMouseOver = () => { setIsHovered(true); }; const handleMouseOut = () => { setIsHovered(false); }; return ( <div className='container'> <h3>React Js TextField onmouseover show text box</h3> <input type="text" placeholder="Hover over me" onMouseOver={handleMouseOver} onMouseOut={handleMouseOut} /> {isHovered && <div>Show Text Box</div>} </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> .container { text-align: center; margin: 50px auto; padding: 20px; width: 300px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); } input { width: 100%; padding: 10px; margin: 10px 0; border-radius: 5px; border: 1px solid #ccc; } .container div { margin-top: 10px; color: #333; } </style> </body> </html>