hotkey
Description
Fires when applying a hotkeyUsage
hotkey:({
key: string,
event: object,
eventSource?: string
}) => void;
Parameters
The callback of the action takes an object with the following parameters:
key- (required) a hotkey name, for the combination of hotkeys use "+", e.g. "shift+arrowup"event- (required) keyboard eventeventSource- (optional) the source of the event call: it can be "grid" or "chart"; it`s required for "arrowup"/"arrowdown"
Example
import { Gantt } from "@svar-ui/react-gantt";
import { getData } from "./common/data";
const data = getData();
const init = (api) => {
api.on("hotkey", (ev) => console.log(ev.key));
};
export default function App() {
return <Gantt init={init} tasks={data.tasks} />;
}
Related articles: