Skip to content

Commit c179c2f

Browse files
committed
Type id prop
1 parent 7891518 commit c179c2f

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

.changeset/tasty-cameras-search.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Updated `SubdomainNavBar` with a new visual variant, content slots, search APIs,
77

88
- Added a `gridline` variant with horizontal and vertical separators.
99
- Added `leadingComponent` and `trailingComponent` props for rendering custom content around the navigation links and actions.
10+
- Added a typed `id` prop for setting an HTML ID on the root element.
1011
- Added a `style` prop for forwarding custom styles to the root element.
1112

1213
```tsx

packages/react/src/SubdomainNavBar/SubdomainNavBar.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ describe('SubdomainNavBar', () => {
146146
expect(getAllByRole('navigation').length > 0).toBeTruthy() // <nav>
147147
})
148148

149+
it('forwards a custom id to the root element', () => {
150+
const {getByRole} = render(<SubdomainNavBar id="docs-navigation" title="Docs" />)
151+
152+
expect(getByRole('banner')).toHaveAttribute('id', 'docs-navigation')
153+
})
154+
149155
it('has no a11y violations by default', async () => {
150156
const {container} = render(<Component />)
151157

packages/react/src/SubdomainNavBar/SubdomainNavBar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export type SubdomainNavBarProps = {
4646
* Forward a custom HTML class attribute
4747
*/
4848
className?: string
49+
/**
50+
* Forward a custom HTML ID to the root element.
51+
*/
52+
id?: string
4953
/**
5054
* Forward custom styles to the root element.
5155
*/

0 commit comments

Comments
 (0)