-
Notifications
You must be signed in to change notification settings - Fork 13
feat (Navbar): add Navbar.center, shadow prop, hideOnScroll Prop, etc. #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
7443d0f
7809f71
8fa1c84
df4e7bd
ef62db5
4f02ce1
8e799ae
33859b9
7500a58
2602aca
dcafa37
64381d7
403121c
75cbe6b
17a21a2
2b1be28
155212d
70be60b
99b5348
e57a5c2
dc12514
40dfe1e
929ed3a
8872390
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| --- | ||
| title: Navbar | ||
| description: A horizontal navigation bar component with flexible left and right sections for building site headers and navigation. | ||
| description: A horizontal navigation bar component with flexible start, center, and end sections for building site headers and navigation. | ||
| source: packages/raystack/components/navbar | ||
| tag: new | ||
| --- | ||
|
|
||
| import { | ||
| preview, | ||
| stickyDemo, | ||
| shadowDemo, | ||
| sectionsDemo, | ||
| hideOnScrollDemo, | ||
| accessibilityDemo, | ||
| } from "./demo.ts"; | ||
|
|
||
|
|
@@ -23,6 +25,7 @@ import { Navbar } from "@raystack/apsara"; | |
|
|
||
| <Navbar> | ||
| <Navbar.Start /> | ||
| <Navbar.Center /> | ||
| <Navbar.End /> | ||
| </Navbar> | ||
| ``` | ||
|
|
@@ -37,13 +40,19 @@ Renders the navigation bar container. | |
|
|
||
| ### Start | ||
|
|
||
| The start section is a container component that accepts all `div` props. It's commonly used for brand logos, primary navigation links, or page titles. | ||
| The start section is a container that accepts Flex props (`align`, `gap`, `direction`, etc.) and section props. It's commonly used for brand logos, primary navigation links, or page titles. | ||
|
|
||
| <auto-type-table path="./props.ts" name="NavbarStartProps" /> | ||
|
|
||
| ### Center | ||
|
|
||
| The center section sits in the middle of the navbar in a fixed position—it stays absolutely centered regardless of the width of Start or End content. The navbar uses a 3-column grid (Start | Center | End) so the center does not shift when left or right content changes. It accepts Flex props and section props. | ||
|
|
||
| <auto-type-table path="./props.ts" name="NavbarCenterProps" /> | ||
|
Comment on lines
+47
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The prose says 🤖 Prompt for AI Agents |
||
|
|
||
| ### End | ||
|
|
||
| The end section is a container component that accepts all `div` props. It's commonly used for search inputs, action buttons, user menus, or secondary navigation. | ||
| The end section is a container that accepts Flex props and section props. It's commonly used for search inputs, action buttons, user menus, or secondary navigation. | ||
|
|
||
| <auto-type-table path="./props.ts" name="NavbarEndProps" /> | ||
|
|
||
|
|
@@ -55,12 +64,24 @@ The Navbar can be made sticky to remain visible at the top of the viewport when | |
|
|
||
| <Demo data={stickyDemo} /> | ||
|
|
||
| ### Shadow | ||
|
|
||
| Use the `shadow` prop to show or hide the bottom shadow. Default is `true`. | ||
|
|
||
| <Demo data={shadowDemo} /> | ||
|
|
||
| ### Section Layouts | ||
|
|
||
| You can use either or both sections depending on your needs. The sections automatically position themselves with proper spacing. | ||
| You can use any combination of Start, Center, and End. The navbar uses a 3-column grid so each section renders in its own space; the center remains absolutely centered. | ||
|
|
||
| <Demo data={sectionsDemo} /> | ||
|
|
||
| ### Hide on scroll | ||
|
|
||
| Set `hideOnScroll` to hide the navbar when the user scrolls down and show it when they scroll up. It works with both window scroll and scroll containers (e.g. ScrollArea). The navbar slides out of view with a transition. The slide animation is only visible when the navbar is sticky (or fixed); without it, the navbar simply scrolls away with the content. | ||
|
|
||
| <Demo data={hideOnScrollDemo} /> | ||
|
|
||
| ### Accessibility | ||
|
|
||
| The Navbar supports custom ARIA labels for better screen reader support. You can provide descriptive labels for the entire navbar or individual sections. | ||
|
|
@@ -73,7 +94,7 @@ The Navbar implements the following accessibility features: | |
|
|
||
| - Proper ARIA roles and attributes | ||
| - `role="navigation"` for the main navbar | ||
| - `role="group"` for Start and End sections when `aria-label` is provided | ||
| - `role="group"` for Start, Center, and End sections when `aria-label` is provided | ||
| - Customizable `aria-label` and `aria-labelledby` support | ||
|
|
||
| - Semantic HTML | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.