ActionList: Add more variant options to ActionList#7924
Conversation
🦋 Changeset detectedLatest commit: 71b5140 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
🤖 Formatting issues have been automatically fixed and committed to this PR. |
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/22540. Will report CI results once ready. |
There was a problem hiding this comment.
Pull request overview
Adds additional layout variants to ActionList and exposes the same variant control on NavList by forwarding it to the underlying ActionList, enabling more granular inset behavior.
Changes:
- Expanded
ActionList’svariantunion to includestart,end, andvertical-inset. - Implemented corresponding CSS behaviors for the new variants and updated Storybook controls.
- Added
NavListvariantprop that forwards toActionList, plus docs/changeset updates.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/NavList/NavList.tsx | Adds variant prop to NavList and forwards it to ActionList. |
| packages/react/src/ActionList/shared.ts | Extends ActionListProps['variant'] type to include new options. |
| packages/react/src/ActionList/Heading.module.css | Updates heading offset rules to account for new list variants. |
| packages/react/src/ActionList/ActionList.stories.tsx | Updates Storybook variant control options to include new variants. |
| packages/react/src/ActionList/ActionList.module.css | Adds styling rules for start/end and vertical inset behavior. |
| packages/react/src/ActionList/ActionList.docs.json | Updates the documented variant type (but description needs updating too). |
| .changeset/actionlist-variant-start-end-vertical-inset.md | Adds a minor changeset entry for the new variants and NavList forwarding. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 5
| /** | ||
| * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges | ||
| */ | ||
| variant?: 'inset' | 'horizontal-inset' | 'full' | ||
| variant?: 'inset' | 'horizontal-inset' | 'vertical-inset' | 'full' | 'start' | 'end' |
| { | ||
| "name": "variant", | ||
| "type": "'inset' | 'horizontal-inset' | 'full'", | ||
| "type": "'inset' | 'horizontal-inset' | 'vertical-inset' | 'full' | 'start' | 'end'", | ||
| "defaultValue": "'inset'", | ||
| "description": "`inset` children are offset (vertically and/or horizontally) from list edges. `full` children are flush (vertically and horizontally) with list edges" | ||
| }, |
| export type NavListProps = { | ||
| children: React.ReactNode | ||
| /** | ||
| * Style variations for the underlying `ActionList`. See `ActionList`'s `variant` prop for details. | ||
| */ | ||
| variant?: ActionListProps['variant'] | ||
| } & React.ComponentProps<'nav'> | ||
|
|
||
| const Root = React.forwardRef<HTMLElement, NavListProps>(({children, ...props}, ref) => { | ||
| const Root = React.forwardRef<HTMLElement, NavListProps>(({children, variant, ...props}, ref) => { | ||
| return ( | ||
| <nav {...props} ref={ref}> | ||
| <ActionListContainerContext.Provider | ||
| value={{ | ||
| container: 'NavList', | ||
| }} | ||
| > | ||
| <ActionList>{children}</ActionList> | ||
| <ActionList variant={variant}>{children}</ActionList> |
| /** | ||
| * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges | ||
| */ | ||
| variant?: 'inset' | 'horizontal-inset' | 'full' | ||
| variant?: 'inset' | 'horizontal-inset' | 'vertical-inset' | 'full' | 'start' | 'end' | ||
| /** |
| ActionList: Add `start`, `end`, and `vertical-inset` options to the `variant` prop. `start` and `end` offset only the start or end edge (`margin-inline-start` / `margin-inline-end`) respectively, and `vertical-inset` offsets items vertically but not horizontally from the list's edges. | ||
|
|
||
| NavList: Add a `variant` prop that is forwarded to the underlying `ActionList`. |
Adds three new
variantoptions toActionListfor more control over how items are offset from the list's edges, and exposes thevariantprop onNavListthat forwards toActionList.start- offsets only the start edge (margin-inline-start)end- offsets only the end edge (margin-inline-end)vertical-inset- offsets items vertically but not horizontallyChangelog
New
variantprop acceptsstart,end, andvertical-inset.NavListnow accepts avariantprop that is forwarded to its underlyingActionList.Rollout strategy
Merge checklist