trackScroll
Description
Optional. Defines whether the dropdown closes when its container is scrolledUsage
trackScroll?: boolean;
Values
true- the dropdown closes when the container (document body or popupContainer) is scrolledfalse- (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