UNPKG

@solid-aria/focus

Version:
31 lines (30 loc) 1.26 kB
import { CreateFocusProps, CreateKeyboardProps } from "@solid-aria/interactions"; import { MaybeAccessor } from "@solid-primitives/utils"; import { Accessor, JSX } from "solid-js"; export interface CreateFocusableProps extends CreateFocusProps, CreateKeyboardProps { /** * Whether focus should be disabled. */ isDisabled?: MaybeAccessor<boolean | undefined>; /** * Whether the element should receive focus on render. */ autofocus?: MaybeAccessor<boolean | undefined>; /** * Whether to exclude the element from the sequential tab order. If true, * the element will not be focusable via the keyboard by tabbing. This should * be avoided except in rare scenarios where an alternative means of accessing * the element or its functionality via the keyboard is available. */ excludeFromTabOrder?: MaybeAccessor<boolean | undefined>; } export interface FocusableResult { /** * Props to spread onto the target element. */ focusableProps: JSX.HTMLAttributes<any>; } /** * Make an element focusable, capable of auto focus and excludable from tab order. */ export declare function createFocusable(props: CreateFocusableProps, ref: Accessor<HTMLElement | undefined>): FocusableResult;