Responsive Popover
Overwriting the default Popover positioning styles on small screens using the updatePosition
prop.
import "./style.css";
import * as Ariakit from "@ariakit/react";
import useMedia from "./use-media.js";
export default function Example() {
const isLarge = useMedia("(min-width: 640px)", true);
const updatePosition = () => {
const { popoverElement, mounted } = popover.getState();
if (!popoverElement) return;
Object.assign(popoverElement.style, {
display: mounted ? "block" : "none",
position: "fixed",
width: "100%",
bottom: "0px",
padding: "12px",
});
};
return (
Accept invite
className="popover"
>
Team meeting
We are going to discuss what we have achieved on the project.
<div>
<p>12 Jan 2022 18:00 to 19:00</p>
<p>Alert 10 minutes before start</p>
</div>
);
}
Follow updates
Join 1,000+ subscribers and receive monthly updates with the latest improvements on Examples.