Skip to content

Commit

Permalink
Update NavList to use the new GroupHeading API and add an as prop t…
Browse files Browse the repository at this point in the history
…o specify the heading level (h3 to match with the default) (#4593)

* Add the default heading level with the as prop for NAvlist.Group

* Create calm-insects-boil.md

* update the comment
  • Loading branch information
broccolinisoup authored and JelloBagel committed May 16, 2024
1 parent b39e370 commit e8ff77c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/calm-insects-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Update NavList to use the new ActionList.GroupHeading API and Add an "as" prop to specify the heading level as default h3. (No changes expected in the rendered HTML)
4 changes: 3 additions & 1 deletion packages/react/src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ const Group: React.FC<NavListGroupProps> = ({title, children, sx: sxProp = defau
<>
{/* Hide divider if the group is the first item in the list */}
<ActionList.Divider sx={{'&:first-child': {display: 'none'}}} />
<ActionList.Group {...props} title={title} sx={sxProp}>
<ActionList.Group {...props} sx={sxProp}>
{/* Setting up the default value for the heading level. TODO: API update to give flexibility to NavList.Group title's heading level */}
<ActionList.GroupHeading as="h3">{title}</ActionList.GroupHeading>
{children}
</ActionList.Group>
</>
Expand Down

0 comments on commit e8ff77c

Please sign in to comment.