Skip to main content

trackScroll

Description​

Optional. Defines whether the dropdown closes when its container is scrolled

Usage​

trackScroll?: boolean;

Values​

  • true - the dropdown closes when the container (document body or popupContainer) is scrolled
  • false - (default) the dropdown remains open regardless of container scroll

Details​

Applies only when inline is false. When enabled, prevents the dropdown from staying open after the input has scrolled out of view.

Example​

import { Dropdown, Calendar } from "@svar-ui/react-core";

function MyDropdown({ popup }) {
return (
<>
{popup && (
<Dropdown trackScroll={true}>
<Calendar value={new Date(2023, 2, 15)} />
</Dropdown>
)}
</>
);
}

export default MyDropdown;

Related article: Closing Dropdown on scroll