[Question]: How to Expand/Collapse Right Panel (Header Panel) #11612
-
Question for CarbonHi! I'm trying to implement the Could you give me some advice? Thanks in regard. Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @AntonSRial to collapse and expand the Something like: const [isExpanded, setIsExpanded] = useState(false);
const toggleExpand = ( ) => {
setIsExpanded(!isExpanded)
}
<HeaderGlobalAction onClick={toggleExpand}> [icon] </HeaderGlobalAction>
<HeaderPanel expanded={isExpanded}> [panel items] </HeaderPanel> |
Beta Was this translation helpful? Give feedback.
Hi @AntonSRial to collapse and expand the
HeaderPanel
component, you'd need to use a state. Set the state value as theexpanded
prop value, and onHeaderGlobalAction
click you would update that state to toggle the expansion.Something like: