Skip to content

Latest commit

 

History

History

HotKeys

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

HotKeys

Add keyboard shortcuts to FOLIO modules or even sub-sections of modules.

Usage

import { HotKeys } from '@folio/stripes/components';
//..
const keys = {
  'delete' : ['delete','backspace'],
};

const handlers = {
  'delete': this.doDelete
};

<HotKeys keyMap={keys} handlers={handlers}>
  <Modal dismissible closeOnBackgroundClick open label="example">
    <button onClick={this.handleClose}>Close modal</button>
  </Modal>
</HotKeys>

Props

Name type description default required
keyMap object Object of named hotkey sequences: e.g. { 'deletion': ['delete', 'backspace'], 'leftArrow': 'left' }
handlers object Object of hotkey sequence names with corresponding handler functions: e.g. { 'delete': this.doDelete }
noWrapper bool if true, HotKeys will attempt to use its child component's outer container as its basis for focus. If false, it will wrap the component in the element with the tagname provided in the component prop. false
component any Tagname of component that will be potentially used to wrap the child component and keep track of focus. 'div'