<div id="root"></div>
.droptab {
  display: block;
  position: fixed;
  background-color: #f90;
  width: 120px;
  padding: 4px;
  border-radius: 5px;
}
const { useState } = React;

const Tabber = props => {
  const { children } = props;
  const [ isDropdown, setIsDropdown ] = useState(false);
  
  const dropStyle = { top: `${isDropdown ? 48 : 0}px` };
  
  return <>
    <h2>{ children }</h2>
    <button onClick={() => setIsDropdown(!isDropdown)}>click me</button>
    <div style={dropStyle} class="droptab">Drop me down</div>
  </>;
};

const root = ReactDOM.createRoot(
  document.getElementById('root')
);
root.render(<Tabber>QnA Habr</Tabber>);

View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //unpkg.com/react/umd/react.development.js
  2. //unpkg.com/react-dom/umd/react-dom.development.js