diff --git a/.changeset/kind-pants-march.md b/.changeset/kind-pants-march.md new file mode 100644 index 00000000000..bcfe017c455 --- /dev/null +++ b/.changeset/kind-pants-march.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Update NavList.Group to render divider when `sx` is provided diff --git a/packages/react/src/NavList/NavList.tsx b/packages/react/src/NavList/NavList.tsx index 360558fded8..25d95737b83 100644 --- a/packages/react/src/NavList/NavList.tsx +++ b/packages/react/src/NavList/NavList.tsx @@ -285,20 +285,11 @@ export type NavListGroupProps = React.HTMLAttributes & { title?: string } & SxProp -const defaultSx = {} -const Group: React.FC = ({title, children, sx: sxProp = defaultSx, ...props}) => { - if (sxProp !== defaultSx) { - return ( - - {title ? {title} : null} - {children} - - ) - } +function Group({title, children, sx, ...rest}: NavListGroupProps) { return ( <> - + {/* Setting up the default value for the heading level. TODO: API update to give flexibility to NavList.Group title's heading level */} {title ? ( @@ -310,6 +301,7 @@ const Group: React.FC = ({title, children, sx: sxProp = defau ) } + // ---------------------------------------------------------------------------- // NavList.GroupExpand