notchbar 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dhruxvsharma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,181 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # notchbar
2
+
3
+ A React navbar that hangs from the top edge of the page like a notch, joined to it by curved shoulders.
4
+
5
+ At the top of the page it is wide and quiet, in a paper tone. Scroll, and it pulls in to a narrower strip of liquid glass that bends whatever passes under it. Scroll back up and it stretches out again with a little overshoot. Menus open one shared panel that changes size between menus and slides its contents the way your pointer moved.
6
+
7
+ ![The tab at the top of the page, in paper](assets/paper.png)
8
+ ![The same tab after scrolling, condensed into glass over a striped band](assets/glass.png)
9
+ ![The Product menu open under the tab](assets/menu.png)
10
+
11
+ ## What it does
12
+
13
+ - **One shape, redrawn live.** The tab and its curved shoulders are a single SVG path traced from the tab's current size. The fill, hairline, inner rim and shadow all follow that path, so nothing comes apart mid-animation.
14
+ - **Squash and stretch.** As the width springs in, the height dips and then settles, so the tab looks like it keeps its volume. The logo and button trail the edges a little and catch up.
15
+ - **Glass that forms.** The paper fades out as the glass forms, a highlight sweeps across it once, and the shadow lands a beat later. In Chromium the backdrop is bent through a displacement filter. Other browsers get plain frosted glass.
16
+ - **Menus that change size.** One panel resizes between menus, and the new content slides in from the side your pointer came from.
17
+ - **Hover that picks one link.** Pointing at a link dims the rest and draws a hand-drawn marker stroke under it. Links that point to a `#section` underline themselves while that section is on screen.
18
+ - **A full phone menu.** Below 768px the links fold into a burger menu, grouped under each menu's heading.
19
+ - **Accessible.** It uses real buttons and links, `aria-expanded` and `aria-controls`, and Escape to close. Focus rings show when you use the keyboard. With reduced motion on, the springs are replaced by plain fades.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm i notchbar motion
25
+ ```
26
+
27
+ It needs `react` 18 or newer, `react-dom` and [`motion`](https://motion.dev).
28
+
29
+ ## Usage
30
+
31
+ Import the component and its stylesheet once:
32
+
33
+ ```tsx
34
+ import { Notchbar, PanelCards, PanelHeader } from "notchbar";
35
+ import "notchbar/styles.css";
36
+
37
+ export function Header() {
38
+ return (
39
+ <Notchbar
40
+ brand={{ name: "Acme" }}
41
+ cta={{ label: "Get started", href: "/signup" }}
42
+ items={[
43
+ {
44
+ label: "Product",
45
+ panel: () => (
46
+ <>
47
+ <PanelHeader title="Product" />
48
+ <PanelCards
49
+ items={[
50
+ { href: "/boards", title: "Boards", text: "Plan the week on one shared surface." },
51
+ { href: "/docs", title: "Docs", text: "Specs that stay next to the work." },
52
+ ]}
53
+ />
54
+ </>
55
+ ),
56
+ mobile: [
57
+ { label: "Boards", href: "/boards" },
58
+ { label: "Docs", href: "/docs" },
59
+ ],
60
+ },
61
+ { label: "Pricing", href: "#pricing" },
62
+ ]}
63
+ />
64
+ );
65
+ }
66
+ ```
67
+
68
+ The nav is `position: fixed`, so give your page some room at the top (about 80px) so it doesn't sit on top of your content.
69
+
70
+ ### Next.js
71
+
72
+ The build already starts with `"use client"`. To get client-side navigation, pass your router's link:
73
+
74
+ ```tsx
75
+ import Link from "next/link";
76
+
77
+ <Notchbar linkComponent={Link} brand={{ name: "Acme" }} items={items} />;
78
+ ```
79
+
80
+ React Router's `Link` works too. It's given `href`, which React Router reads as `to`, so wrap it if you need to:
81
+
82
+ ```tsx
83
+ const RouterLink = ({ href, ...rest }) => <Link to={href} {...rest} />;
84
+ ```
85
+
86
+ ## Props
87
+
88
+ | Prop | Type | Default | |
89
+ |---|---|---|---|
90
+ | `brand` | `{ name, href?, mark?, label? }` | | The logo link on the left. `mark` replaces the default square logo. `label` is the accessible name, which defaults to "*name*, home". |
91
+ | `items` | `NavItem[]` | | The links in the middle, in order. See below. |
92
+ | `cta` | `{ label, href }` | | The button on the right. Leave it out to hide the button. |
93
+ | `linkComponent` | `ElementType` | `"a"` | Your router's link component. |
94
+ | `accent` | `string` | `#e5484d` | The marker colour, used for the hover strokes, the button's dot and "New" marks. |
95
+ | `maxWidth` | `number` | `1024` | How wide the tab gets at the top of the page, in px. |
96
+ | `compactAt` | `number` | `56` | How far down (px) the page scrolls before the tab condenses. |
97
+ | `expandAt` | `number` | `24` | How close to the top (px) before it stretches out again. The gap between this and `compactAt` stops it flickering. |
98
+ | `className` | `string` | | Added to the outer `<header>`. |
99
+
100
+ ### Items
101
+
102
+ An item is either a plain link or a menu.
103
+
104
+ ```ts
105
+ type NavLinkItem = { label: string; href: string };
106
+
107
+ type NavMenu = {
108
+ label: string;
109
+ panel: (ctx: { close: () => void; reduced: boolean }) => ReactNode;
110
+ width?: string; // the panel's width, any CSS length. Default 36rem
111
+ mobile?: MobileLink[]; // what this menu lists in the phone menu
112
+ };
113
+
114
+ type MobileLink = { label: string; href: string; meta?: string; badge?: ReactNode };
115
+ ```
116
+
117
+ A link whose `href` starts with `#` marks itself while that section is on screen.
118
+
119
+ ## Panel building blocks
120
+
121
+ A panel can hold anything. These blocks already match the nav's style and its entrance animation:
122
+
123
+ | Block | What it is |
124
+ |---|---|
125
+ | `PanelHeader` | A small mono heading row, with an optional note on the right. |
126
+ | `PanelRows` | One link per row, with a note on the right and an arrow that slides in on hover. |
127
+ | `PanelCards` | Links with an icon tile, a title and a line of description. |
128
+ | `PanelGrid` | A compact two-column grid of short links. |
129
+ | `PanelSplit` | Two columns with a hairline between them. |
130
+ | `PanelFooter` | A quiet strip along the bottom. |
131
+ | `PanelLink` | A link with an underline that draws in from the left. Made for the footer. |
132
+ | `NewMark` | "New", circled in marker. |
133
+ | `NavLink` | A plain link that uses your `linkComponent`. |
134
+ | `usePanel()` | Returns `{ close, reduced }` for your own panel content. Call `close` when someone picks a link. |
135
+
136
+ ```tsx
137
+ {
138
+ label: "Resources",
139
+ width: "40rem",
140
+ panel: () => (
141
+ <PanelSplit
142
+ left={<PanelRows rows={[{ href: "/guides", title: "Guides", meta: "12" }]} />}
143
+ right={<PanelGrid title="Popular" links={[{ href: "/roadmaps", label: "Roadmaps" }]} />}
144
+ />
145
+ ),
146
+ }
147
+ ```
148
+
149
+ ## Theming
150
+
151
+ Everything is plain CSS with `nb-` class names and custom properties. Override them on `.nb` or on any ancestor:
152
+
153
+ ```css
154
+ .nb {
155
+ --nb-ink: #111; /* text */
156
+ --nb-muted: #8f8f8a; /* secondary text */
157
+ --nb-paper: #efefec; /* the tab at the top of the page */
158
+ --nb-glass: rgba(255, 255, 255, 0.42); /* the glass tint */
159
+ --nb-font-mono: ui-monospace, Menlo, monospace;
160
+ --nb-font-marker: "Gochi Hand", "Comic Sans MS", cursive;
161
+ }
162
+ ```
163
+
164
+ The nav takes the font of the page around it. The "New" marks look best with a handwriting font like [Gochi Hand](https://fonts.google.com/specimen/Gochi+Hand).
165
+
166
+ ## Browser support
167
+
168
+ The tab, the menus and the motion work in every evergreen browser. The bending glass uses an SVG filter inside `backdrop-filter`, which only Chromium supports. Safari and Firefox get frosted glass. When someone has *reduce transparency* turned on, the glass becomes solid.
169
+
170
+ ## Run the demo
171
+
172
+ ```bash
173
+ git clone https://github.com/dhruxvsharma/notchbar
174
+ cd notchbar
175
+ npm install
176
+ npm run demo
177
+ ```
178
+
179
+ ## License
180
+
181
+ MIT