popover-reach-fr
v0.16.7
Published
Render a portal positioned relative to another element.
Downloads
171
Readme
@reach/popover
import * as React from "react";
import Popover, { positionDefault } from "@reach/popover";
function Example() {
const ref = React.useRef(null);
const [value, setValue] = React.useState("");
return (
<div>
<label>
<span>Type for a special message</span>
<input
type="text"
ref={ref}
onChange={(event) => setValue(event.target.value)}
/>
</label>
{value.length > 0 && (
<Popover targetRef={ref} position={positionDefault}>
<div>
<p>Whoa! Look at me!</p>
</div>
</Popover>
)}
</div>
);
}