Skip to main content

api.exec()

Description​

Allows triggering the File Manager actions

Usage​

api.exec(
action: string,
config: object
): void;

Parameters​

  • action - (required) an action to be fired
  • config - (required) the config object with parameters (see the action to be fired)

Actions​

info

The full list of the File Manager actions can be found here

Example​

In the example below we clear the filter when the Preview panel is closed or opened.

import { useRef } from "react";
import { getData, getDrive } from "./common/data";
import { Filemanager } from "@svar-ui/react-filemanager";

export default function Example() {
const api = useRef(null);

function clearSearch() {
api.current?.exec("filter-files", {
text: "",
});
}

return (
<Filemanager
data={getData()}
drive={getDrive()}
ref={api}
onShowPreview={clearSearch}
/>
);
}

Related articles: