From c94fe8b8e4315a7cbb287323a5820b2cf7ecd0b8 Mon Sep 17 00:00:00 2001 From: Rebecca Alpert Date: Wed, 22 Oct 2025 12:09:31 -0400 Subject: [PATCH 1/2] feat(ActionList): Add isVertical variant --- packages/react-core/package.json | 2 +- .../src/components/ActionList/ActionList.tsx | 13 +++++- .../ActionList/__tests__/ActionList.test.tsx | 12 +++++ .../ActionList/examples/ActionList.md | 6 +++ .../examples/ActionListVertical.tsx | 46 +++++++++++++++++++ packages/react-docs/package.json | 2 +- packages/react-icons/package.json | 2 +- packages/react-styles/package.json | 2 +- packages/react-tokens/package.json | 4 +- yarn.lock | 28 +++++------ 10 files changed, 96 insertions(+), 21 deletions(-) create mode 100644 packages/react-core/src/components/ActionList/examples/ActionListVertical.tsx diff --git a/packages/react-core/package.json b/packages/react-core/package.json index 026596a8cbc..d26c696fda1 100644 --- a/packages/react-core/package.json +++ b/packages/react-core/package.json @@ -54,7 +54,7 @@ "tslib": "^2.8.1" }, "devDependencies": { - "@patternfly/patternfly": "6.4.0", + "@patternfly/patternfly": "6.5.0-prerelease.3", "case-anything": "^3.1.2", "css": "^3.0.0", "fs-extra": "^11.3.0" diff --git a/packages/react-core/src/components/ActionList/ActionList.tsx b/packages/react-core/src/components/ActionList/ActionList.tsx index 08f0b57ed5c..ebced6b15d9 100644 --- a/packages/react-core/src/components/ActionList/ActionList.tsx +++ b/packages/react-core/src/components/ActionList/ActionList.tsx @@ -8,15 +8,26 @@ export interface ActionListProps extends React.HTMLProps { isIconList?: boolean; /** Additional classes added to the action list */ className?: string; + /** Whether the layout of children is vertical or horizontal. */ + isVertical?: boolean; } export const ActionList: React.FunctionComponent = ({ children, isIconList, className, + isVertical = false, ...props }: ActionListProps) => ( -
+
{children}
); diff --git a/packages/react-core/src/components/ActionList/__tests__/ActionList.test.tsx b/packages/react-core/src/components/ActionList/__tests__/ActionList.test.tsx index c1ed3bb8d47..5bb4d943fdb 100644 --- a/packages/react-core/src/components/ActionList/__tests__/ActionList.test.tsx +++ b/packages/react-core/src/components/ActionList/__tests__/ActionList.test.tsx @@ -37,6 +37,18 @@ test(`Renders with class ${styles.modifiers.icons} when isIconList is true`, () expect(screen.getByText('Test')).toHaveClass(styles.modifiers.icons); }); +test(`Does not render with class ${styles.modifiers.vertical} by default`, () => { + render(Test); + + expect(screen.getByText('Test')).not.toHaveClass(styles.modifiers.vertical); +}); + +test(`Renders with class ${styles.modifiers.vertical} when isVertical is true`, () => { + render(Test); + + expect(screen.getByText('Test')).toHaveClass(styles.modifiers.vertical); +}); + test('Renders with inherited element props spread to the component', () => { render(Test); diff --git a/packages/react-core/src/components/ActionList/examples/ActionList.md b/packages/react-core/src/components/ActionList/examples/ActionList.md index e23eba3e738..6c72fb22a53 100644 --- a/packages/react-core/src/components/ActionList/examples/ActionList.md +++ b/packages/react-core/src/components/ActionList/examples/ActionList.md @@ -35,3 +35,9 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico ```ts file="./ActionListWithCancelButton.tsx" ``` + +### Vertical action list + +```ts file="./ActionListVertical.tsx" isBeta + +``` diff --git a/packages/react-core/src/components/ActionList/examples/ActionListVertical.tsx b/packages/react-core/src/components/ActionList/examples/ActionListVertical.tsx new file mode 100644 index 00000000000..92cdb7118d2 --- /dev/null +++ b/packages/react-core/src/components/ActionList/examples/ActionListVertical.tsx @@ -0,0 +1,46 @@ +import { ActionList, ActionListGroup, ActionListItem, Button } from '@patternfly/react-core'; +import CheckIcon from '@patternfly/react-icons/dist/esm/icons/check-icon'; +import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon'; + +export const ActionListVertical: React.FunctionComponent = () => ( + <> +

Multiple groups

+ + + + + + + + + + + + + + + + + + +

Icons, in two groups

+ + + +