UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

31 lines (26 loc) 710 B
/** * Copyright IBM Corp. 2020, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { createContext, useContext } from 'react'; /** * ------------- * Context setup * ------------- */ const PageHeaderContext = /*#__PURE__*/createContext({ fullyCollapsed: false, setRefs: () => {}, refs: {}, titleClipped: false }); function usePageHeader() { const context = useContext(PageHeaderContext); if (!context) { throw new Error('Page header context was not provided or hook was used outside of the Page header component.'); } return context; } export { PageHeaderContext, usePageHeader };