UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

34 lines (33 loc) 1.28 kB
import React from "react"; export interface VirtualFocusAnchorProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "id"> { /** * The role of the container. This is a limited subset of roles that * require manual focus management. * * Children that are to get focus inside this container element shall be * pointed to by `aria-activedescendant`. **/ role: "combobox" | "grid" | "listbox" | "menu" | "menubar" | "radiogroup" | "tree" | "treegrid" | "tablist"; /** * The function that is run when the focused element * is to be selected (eg. do an actual search, change route... etc) */ onSelect: () => void; /** * The function that is run when the element gets * virtual focus set to it. */ onActive: () => void; children: React.ReactElement; /** * Set this to `0` if you want the Anchor itself * to be focusable. Since this Anchor is hoisted & merged with * its first child, you most likely want to keep this as `0`. * @default 0 */ tabIndex?: number; } /** * Must have a single child that is an input element. */ export declare const VirtualFocusAnchor: React.ForwardRefExoticComponent<VirtualFocusAnchorProps & React.RefAttributes<HTMLInputElement>>;