### Open/Close Help Panel You can invoke the openHelpPanel method available from the AppLayoutContext from your component (must be descendants of AppLayout component) to trigger open of the help panel programmatically. ```jsx static import { useAppLayoutContext } from 'aws-northstar/layouts/AppLayout'; ... const { openHelpPanel } = useAppLayoutContext(); ... return ( ... ... ) ``` ### Dynamically set Help Panel content ```jsx static import AppLayout, { useAppLayoutContext } from 'aws-northstar/layouts/AppLayout'; import React from 'react'; const DynamicHelpPanelSubComponent: React.FunctionComponent = ({ children }) => { const { setHelpPanelContent } = useAppLayoutContext(); useEffect(() => { setHelpPanelContent(
Dynamic Content!
); }, [setHelpPanelContent]); return children; }; export const DynamicHelpPanel = () => { return ( Header}>
Main content
); }; ``` ### Examples **More examples** are available on NorthStar Storybook. ```jsx import { useState, useCallback } from 'react'; import { BrowserRouter } from 'react-router-dom'; import { v4 as uuidv4 } from 'uuid'; import AppLayout, { Notification, useAppLayoutContext } from 'aws-northstar/layouts/AppLayout'; import Box from 'aws-northstar/layouts/Box'; import Header from 'aws-northstar/components/Header'; import SideNavigation, { SideNavigationItemType } from 'aws-northstar/components/SideNavigation'; import ColumnLayout, { Column } from 'aws-northstar/layouts/ColumnLayout'; import KeyValuePair from 'aws-northstar/components/KeyValuePair'; import Badge from 'aws-northstar/components/Badge'; import BreadcrumbGroup from 'aws-northstar/components/BreadcrumbGroup'; import HelpPanel from 'aws-northstar/components/HelpPanel'; import Link from 'aws-northstar/components/Link'; import Text from 'aws-northstar/components/Text'; import Heading from 'aws-northstar/components/Heading'; import Stack from 'aws-northstar/layouts/Stack'; import Button from 'aws-northstar/components/Button'; const header =
; const navigationItems = [ { type: SideNavigationItemType.LINK, text: 'Page 1', href: '/page1' }, { type: SideNavigationItemType.LINK, text: 'Page 2', href: '/page2' }, { type: SideNavigationItemType.LINK, text: 'Page 3', href: '/page3' }, { type: SideNavigationItemType.LINK, text: 'Page 4', href: '/page4' }, { type: SideNavigationItemType.DIVIDER }, { type: SideNavigationItemType.LINK, text: 'Notifications', href: '/notifications', info: , }, { type: SideNavigationItemType.LINK, text: 'Documentation', href: 'https://docs.yoursite.com', } ]; const navigation = ( ); const helpPanel = ( Link to internal documentation, Link to external documentation, ]} > This is a paragraph with some bold text and also some italic text. h4 section header h5 section header ); const splitPanel = ( ); const breadcrumbGroup = ( ); const defaultNotifications = [ { id: '1', header: 'Successfully updated 4 orders', type: 'success', content: 'This is a success flash message.', dismissible: true, }, { id: '2', header: 'Failed to update 1 order', type: 'error', content: 'This is a dismissible error message with a button.', buttonText: 'Retry', onButtonClick: () => console.log('Button clicked'), dismissible: true, }, { id: '3', header: 'Warning', type: 'warning', content: 'This is warning content', dismissible: true, } ]; const MainContent = () => { const { openHelpPanel, openSplitPanel, addNotification, dismissNotifications } = useAppLayoutContext(); const [ notificationId, setNotificationId ] = useState(); const handleAddClick = useCallback(() => { const id = uuidv4(); addNotification({ id, type: 'success', header: `Your request ${id} is being processed`, dismissible: true, }); setNotificationId(id); }, [addNotification]); const handleRemoveLastClick = useCallback(() => { notificationId && dismissNotifications(notificationId); }, [dismissNotifications, notificationId]); const handleRemoveAll = useCallback(() => { dismissNotifications(); }, [dismissNotifications]); return ( Main Content ) } const [notifications, setNotifications] = useState(defaultNotifications); const handleDismiss = (id) => { setNotifications(notifications.filter(n => n.id !== id)); }; ({ ...n, onDismiss: () => handleDismiss(n.id) }))} > ```