| 1 |
import { useState } from 'react'; |
| 2 |
import { ExpandableSection } from '@patternfly/react-core'; |
| 3 |
|
| 4 |
export const ExpandableSectionBasic: React.FunctionComponent = () => { |
| 5 |
const [isExpanded, setIsExpanded] = useState(false); |
| 6 |
|
| 7 |
const onToggle = (_event: React.MouseEvent, isExpanded: boolean) => { |
| 8 |
setIsExpanded(isExpanded); |
| 9 |
}; |
| 10 |
|
| 11 |
return ( |
| 12 |
<ExpandableSection |
| 13 |
toggleText={isExpanded ? 'Show less basic example content' : 'Show more basic example content'} |
| 14 |
onToggle={onToggle} |
| 15 |
isExpanded={isExpanded} |
| 16 |
> |
| 17 |
This content is visible only when the component is expanded. |
| 18 |
</ExpandableSection> |
| 19 |
); |
| 20 |
}; |