src/platform/packages/shared/react/env/README.md
Hooks for accessing Kibana environment information. The environment context is automatically provided by @kbn/react-kibana-context-root at the application root when app is wrapped in core rendering context (core.rendering.addContext).
Returns true if Kibana is running in serverless mode.
import { useIsServerless } from '@kbn/react-env';
export const MyComponent = () => {
const isServerless = useIsServerless();
return <div>{isServerless ? 'Serverless' : 'Stateful'}</div>;
};
Returns the current Kibana version.
import { useKibanaVersion } from '@kbn/react-env';
export const MyComponent = () => {
const version = useKibanaVersion();
return <div>Version: {version}</div>;
};
Returns true if Kibana is running in development mode.
import { useIsDevMode } from '@kbn/react-env';
export const MyComponent = () => {
const isDevMode = useIsDevMode();
return <div>{isDevMode ? 'Dev Mode' : 'Production'}</div>;
};