Skip to content

useKlinechartsUI

The primary hook. Returns the full context: state, dispatch, datafeed and the fullscreen container ref.

const { state, dispatch, datafeed, onSettingsChange, fullscreenContainerRef } =
useKlinechartsUI();
interface KlinechartsUIContextValue {
state: KlinechartsUIState;
dispatch: Dispatch<KlinechartsUIAction>; // enhancedDispatch with synchronous callbacks
datafeed: Datafeed;
onSettingsChange?: (settings: Record<string, unknown>) => void;
fullscreenContainerRef: RefObject<HTMLElement | null>;
}

Most features have a dedicated hook (see the sidebar). Reach for useKlinechartsUI directly when you need the raw chart instance (state.chart) or to dispatch an action no hook wraps.

See State & Actions for the full state and action shapes.