Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class ExpandableSection extends React.Component<ExpandableSectionProps, Expandab
<AngleRightIcon aria-hidden />
</span>
)}
<span className={css(`${styles.expandableSection}__toggle-text`)}>{toggleContent || computedToggleText}</span>
<span className={css(styles.expandableSectionToggleText)}>{toggleContent || computedToggleText}</span>
</button>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const ExpandableSectionToggle: React.FunctionComponent<ExpandableSectionT
<AngleRightIcon aria-hidden />
</span>
)}
<span className={css(`${styles.expandableSection}__toggle-text`)}>{children}</span>
<span className={css(styles.expandableSectionToggleText)}>{children}</span>
</button>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ When passing the `isDetached` property into `<ExpandableSection>`, you must also

### Disclosure variation

You can pass in the `displaySize="lg"` property for a disclosure variation styling.

```ts file="ExpandableSectionDisclosure.tsx"

```

### Indented
### Indented expandable content

You can indent the expandable content by passing in the `isIndented` property. This will not affect the expandable toggle.

```ts file="ExpandableSectionIndented.tsx"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
import React from 'react';
import { ExpandableSection } from '@patternfly/react-core';
import React, { FormEvent } from 'react';
import { ExpandableSection, Checkbox } from '@patternfly/react-core';

export const ExpandableSectionIndented: React.FunctionComponent = () => {
const [isExpanded, setIsExpanded] = React.useState(false);
const [isExpanded, setIsExpanded] = React.useState(true);
const [isDisplayLgChecked, setIsDisplayLgChecked] = React.useState(false);

const onToggle = (_event: React.MouseEvent, isExpanded: boolean) => {
setIsExpanded(isExpanded);
};

const onDisplaySizeCheck = (_event: FormEvent<HTMLInputElement>, checked: boolean) => setIsDisplayLgChecked(checked);

return (
<ExpandableSection
toggleText={isExpanded ? 'Show less' : 'Show more'}
onToggle={onToggle}
isExpanded={isExpanded}
isIndented
>
This content is visible only when the component is expanded.
</ExpandableSection>
<>
<Checkbox
id="displaySize-checkbox"
isChecked={isDisplayLgChecked}
label='displaySize="lg"'
onChange={onDisplaySizeCheck}
/>
<br />
<ExpandableSection
toggleText={isExpanded ? 'Show less' : 'Show more'}
onToggle={onToggle}
isExpanded={isExpanded}
isIndented
displaySize={isDisplayLgChecked ? 'lg' : 'default'}
>
This content is visible only when the component is expanded.
</ExpandableSection>
</>
);
};