@dxos/react-ui
    Preparing search index...

    Function clickableProps

    • Props that make a non-button element (a Card, a Card row, an Image frame) a button when it has an onClick: focusable and activated by Enter and Space, but only when it is itself the target, so a nested control's keys stay its own. Without onClick only the caller's onKeyDown passes through.

      Type Parameters

      • T extends HTMLElement

      Parameters

      • onClick: undefined | ((event: MouseEvent<T>) => void)
      • onKeyDown: undefined | ((event: KeyboardEvent<T>) => void)

      Returns
          | {
              onClick: (event: MouseEvent<T>) => void;
              onKeyDown: (event: KeyboardEvent<T>) => void;
              role: string;
              tabIndex: number;
          }
          | {
              onClick?: undefined;
              onKeyDown: undefined
              | ((event: KeyboardEvent<T>) => void);
              role?: undefined;
              tabIndex?: undefined;
          }