Skip to content

Commit 36d0b7a

Browse files
authored
fix(Navbar): add missing type for sticky bottom (#6726)
1 parent a58a0cd commit 36d0b7a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/Navbar.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface NavbarProps
2222
expand?: boolean | string | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
2323
bg?: string;
2424
fixed?: 'top' | 'bottom';
25-
sticky?: 'top';
25+
sticky?: 'top' | 'bottom';
2626
onToggle?: (expanded: boolean) => void;
2727
onSelect?: SelectCallback;
2828
collapseOnSelect?: boolean;
@@ -63,12 +63,10 @@ const propTypes = {
6363
fixed: PropTypes.oneOf(['top', 'bottom']),
6464

6565
/**
66-
* Position the navbar at the top of the viewport, but only after scrolling past it.
67-
* A convenience prop for the `sticky-top` positioning class.
68-
*
69-
* __Not supported in <= IE11 and other older browsers without a polyfill__
66+
* Position the navbar at the top or bottom of the viewport, but only after scrolling past it.
67+
* A convenience prop for the `sticky-*` positioning classes.
7068
*/
71-
sticky: PropTypes.oneOf(['top']),
69+
sticky: PropTypes.oneOf(['top', 'bottom']),
7270

7371
/**
7472
* Set a custom element for this component.

www/docs/components/navbar.mdx

+12-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ likely require custom styling to work well.
4141
</CodeBlock>
4242

4343
## Forms
44+
4445
Use `<Form inline>` and your various form controls within the Navbar.
4546
Align the contents as needed with utility classes.
4647

@@ -99,13 +100,13 @@ viewports when your navbar is collapsed.
99100

100101
You can use Bootstrap's <DocLink path="/utilities/position/">position utilities</DocLink> to
101102
place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or
102-
stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed
103-
navbars use `position: fixed`, meaning they’re pulled from the normal flow of the DOM and may
103+
stickied to the top (scrolls with the page until it reaches the top, then stays there), or
104+
stickied to the bottom (scrolls with the page until it reaches the bottom, then stays there).
105+
106+
Fixed navbars use `position: fixed`, meaning they’re pulled from the normal flow of the DOM and may
104107
require custom CSS (e.g., padding-top on the `<body>`) to prevent overlap with other elements.
105-
Also note that `.sticky-top` uses `position: sticky`, which
106-
[isn’t fully supported in every browser](https://caniuse.com/#feat=css-sticky).
107108

108-
Since these positioning needs are so common for Navbars, we've added convenience props for them.
109+
Since these positioning needs are so common for navbars, we've added convenience props for them.
109110

110111
### Fixed top
111112

@@ -125,6 +126,12 @@ Since these positioning needs are so common for Navbars, we've added convenience
125126
<Navbar sticky="top" />
126127
```
127128

129+
### Sticky bottom
130+
131+
```jsx
132+
<Navbar sticky="bottom" />
133+
```
134+
128135
## Scrolling
129136

130137
You can use the `navbarScroll` prop in a `<Nav>` to enable vertical scrolling within the toggleable

0 commit comments

Comments
 (0)