import { useState } from 'react'; import { ExpandableSection, Badge, Stack, StackItem } from '@patternfly/react-core'; import RhUiCheckCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-check-circle-fill-icon'; export const ExpandableSectionCustomToggle: React.FunctionComponent = () => { const [isExpanded, setIsExpanded] = useState(false); const onToggle = (_event: React.MouseEvent, isExpanded: boolean) => { setIsExpanded(isExpanded); }; return (

Custom Toggle Content

You can use custom content such as icons and badges in the toggle:

You can also use icons or badges 4 ! } onToggle={onToggle} isExpanded={isExpanded} > This content is visible only when the component is expanded.

Accessibility Note

Important: If you need the toggle text to function as a heading in the document structure, do NOT put heading elements (h1-h6) inside the toggleContent prop, as this creates invalid HTML structure. Instead, use the toggleWrapper prop.

); };