Skip to content

Commit 65fcd9f

Browse files
Navlist passthrough action list group props (#2133)
* passthrough actionlist group props to navlist.group * changeset * pass through props * fix pass through block * Update docs/content/NavList.mdx * avoid passing through action list props, but spread additional props to allow aria and data attributes through Co-authored-by: Cole Bemis <[email protected]>
1 parent c7abeb3 commit 65fcd9f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/smooth-balloons-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Passthrough ActionList.Group props from NavList.Group

src/NavList/NavList.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,14 @@ export type NavListGroupProps = {
240240
title?: string
241241
} & SxProp
242242

243+
const defaultSx = {}
243244
// TODO: ref prop
244-
const Group = ({title, children, sx: sxProp = {}}: NavListGroupProps) => {
245+
const Group: React.VFC<NavListGroupProps> = ({title, children, sx: sxProp = defaultSx, ...props}) => {
245246
return (
246247
<>
247248
{/* Hide divider if the group is the first item in the list */}
248249
<ActionList.Divider sx={{'&:first-child': {display: 'none'}}} />
249-
<ActionList.Group title={title} sx={sxProp}>
250+
<ActionList.Group {...props} title={title} sx={sxProp}>
250251
{children}
251252
</ActionList.Group>
252253
</>

0 commit comments

Comments
 (0)