Home > @activeviam/activeui-sdk > useDisplayMode
useDisplayMode() function
A React hook that provides the current display mode as well as a function to change it.
Signature:
export declare function useDisplayMode(): DisplayModeProps;
Returns:
Example
const {displayMode, setDisplayMode, canChangeDisplayMode} = useDisplayMode();
[...]
<Button onClick={() => {
// ensures setDisplayMode will not throw an error
if (canChangeDisplayMode()) {
setDisplayMode(DisplayMode.VIEW);
}
}}/>