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 committed May 16, 2024
1 parent c81898c commit d4e234f
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 d4e234f

Please sign in to comment.