@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
23 lines (22 loc) • 858 B
TypeScript
import * as React from "react";
interface FocusScopeProps extends React.HTMLAttributes<HTMLDivElement> {
/**
* Event handler called on mount, unless the component already has focus. Used for auto-focusing.
* Can be prevented.
*/
onMountHandler?: (event: Event) => void;
/**
* Event handler called on unmount. Used for auto-focusing.
* Can be prevented.
*/
onUnmountHandler?: (event: Event) => void;
}
/**
* FocusScope manages focus on mount and unmount of container.
* This is used to better handle autofocus of elements when mounted and unmounted.
* Example usage:
* - Focus first item in a list when mounted
* - Focus a button when unmounted
*/
declare const FocusScope: React.ForwardRefExoticComponent<FocusScopeProps & React.RefAttributes<HTMLDivElement>>;
export { FocusScope, type FocusScopeProps };