@@ -112,32 +112,33 @@ export function SiteNav() {
112112 onValueChange = { setLocale }
113113 cta = { { label: " Get Started" , href: " /signup" }}
114114 showGitHub
115+ githubUrl = " your-org/your-repo" // or a full URL
115116 />
116117 );
117118}
118119```
119120
120121## Props
121122
122- | Prop | Type | Required | Description |
123- | --------------- | --------------------------------- | -------- | ---------------------------------------------------------------- |
124- | ` logo ` | ` React.ReactNode ` | No | Logo element (renders before nav links) |
125- | ` links ` | ` NavLink[] ` | No | Navigation links |
126- | ` activeHref ` | ` string ` | No | ` href ` of the current page — gets ` aria-current ` and a highlight |
127- | ` locales ` | ` Locale[] ` | No | Available locales for language selector |
128- | ` value ` | ` string ` | No | Selected locale code — pass this to control the component |
129- | ` defaultValue ` | ` string ` | No | Initial locale code when uncontrolled (default: first locale) |
130- | ` onValueChange ` | ` (code: string) => void ` | No | Callback when locale changes |
131- | ` cta ` | ` { label: string; href: string } ` | No | CTA button |
132- | ` showGitHub ` | ` boolean ` | No | Show GitHub icon button |
133- | ` githubUrl ` | ` string ` | No | GitHub repository URL |
134- | ` sticky ` | ` boolean ` | No | Make navbar sticky at top (default: ` true ` ) |
135- | ` variant ` | ` "default" \| "floating" ` | No | Full-width bar or inset floating card (default: ` "default" ` ) |
136- | ` showFlags ` | ` boolean ` | No | Show flags in language selector (default: ` true ` ) |
137- | ` maxHeight ` | ` number \| string ` | No | Max height of the scrolling language menu (default: ` "15rem" ` ) |
138- | ` linkComponent ` | ` React.ElementType ` | No | Component used for internal links (default: ` "a" ` ) |
139- | ` classNames ` | ` NavBarClassNames ` | No | Per-part class overrides (see below) |
140- | ` className ` | ` string ` | No | Additional CSS classes |
123+ | Prop | Type | Required | Description |
124+ | --------------- | --------------------------------- | -------- | ----------------------------------------------------------------------------- |
125+ | ` logo ` | ` React.ReactNode ` | No | Logo element (renders before nav links) |
126+ | ` links ` | ` NavLink[] ` | No | Navigation links |
127+ | ` activeHref ` | ` string ` | No | ` href ` of the current page — gets ` aria-current ` and a highlight |
128+ | ` locales ` | ` Locale[] ` | No | Available locales for language selector |
129+ | ` value ` | ` string ` | No | Selected locale code — pass this to control the component |
130+ | ` defaultValue ` | ` string ` | No | Initial locale code when uncontrolled (default: first locale) |
131+ | ` onValueChange ` | ` (code: string) => void ` | No | Callback when locale changes |
132+ | ` cta ` | ` { label: string; href: string } ` | No | CTA button |
133+ | ` showGitHub ` | ` boolean ` | No | Show the GitHub icon button. Needs ` githubUrl ` — without one, nothing renders |
134+ | ` githubUrl ` | ` string ` | No | Full URL, or ` "owner" ` / ` "owner/repo" ` shorthand for github.com |
135+ | ` sticky ` | ` boolean ` | No | Make navbar sticky at top (default: ` true ` ) |
136+ | ` variant ` | ` "default" \| "floating" ` | No | Full-width bar or inset floating card (default: ` "default" ` ) |
137+ | ` showFlags ` | ` boolean ` | No | Show flags in language selector (default: ` true ` ) |
138+ | ` maxHeight ` | ` number \| string ` | No | Max height of the scrolling language menu (default: ` "15rem" ` ) |
139+ | ` linkComponent ` | ` React.ElementType ` | No | Component used for internal links (default: ` "a" ` ) |
140+ | ` classNames ` | ` NavBarClassNames ` | No | Per-part class overrides (see below) |
141+ | ` className ` | ` string ` | No | Additional CSS classes |
141142
142143Any other prop is spread onto the underlying ` <nav> ` element, and the ref is
143144forwarded to it.
@@ -244,6 +245,7 @@ export default function App() {
244245 }}
245246 cta = { { label: " Get Started" , href: " /signup" }}
246247 showGitHub
248+ githubUrl = " your-org/your-repo"
247249 />
248250 );
249251}
@@ -329,6 +331,18 @@ export default function App() {
329331}
330332```
331333
334+ ### GitHub link
335+
336+ ` showGitHub ` adds an icon button that links to ` githubUrl ` . Pass ` "owner/repo" ` for a
337+ repository, ` "owner" ` for a profile or organisation, or any full URL.
338+
339+ ``` tsx
340+ <NavBar showGitHub githubUrl = " acme/website" />
341+ <NavBar showGitHub githubUrl = " https://github.com/acme" />
342+ ```
343+
344+ ` showGitHub ` without ` githubUrl ` renders no button and logs a warning.
345+
332346### Non-sticky
333347
334348``` tsx
0 commit comments