@neynar/ui
Version:
React UI component library built on shadcn/ui and Tailwind CSS
109 lines (98 loc) • 2.58 kB
Markdown
for navigation menus A versatile link component designed specifically for navigation menus with comprehensive styling and state management. Supports active states, hover/focus effects, and seamless framework integration through the asChild pattern. Can be used both within dropdown content and as direct navigation items. Features proper keyboard navigation and accessibility support.
```jsx
import { NavigationMenuLink } from '@neynar/ui';
<NavigationMenuLink
asChild={true}
active={true}
onSelect={handleSelect}
/>
```
- **Type**: `boolean`
- **Required**: No
- **Description**: No description available
- **Type**: `boolean`
- **Required**: No
- **Description**: No description available
- **Type**: `(event: Event) => void`
- **Required**: No
- **Description**: No description available
```tsx
// Basic navigation link
<NavigationMenuLink href="/about">About Us</NavigationMenuLink>
```
```tsx
// Active link with current page styling
<NavigationMenuLink href="/dashboard" active>
Dashboard
</NavigationMenuLink>
```
```tsx
// Rich content link in dropdown with description
<NavigationMenuLink href="/features/analytics">
<div className="text-sm font-medium leading-none">Analytics</div>
<p className="text-sm text-muted-foreground mt-1">
View detailed insights and performance metrics
</p>
</NavigationMenuLink>
```
```tsx
// With Next.js Link using asChild pattern
<NavigationMenuLink asChild>
<Link href="/products" prefetch={false}>
Products
</Link>
</NavigationMenuLink>
```
```tsx
// With Remix Link using asChild pattern
<NavigationMenuLink asChild>
<RemixLink to="/docs" prefetch="intent">
Documentation
</RemixLink>
</NavigationMenuLink>
```
```tsx
// Direct navigation with trigger button styling
<NavigationMenuLink
href="/contact"
className={navigationMenuTriggerStyle()}
>
Contact Us
</NavigationMenuLink>
```
```tsx
// With custom selection handler
<NavigationMenuLink
href="/logout"
onSelect={(event) => {
event.preventDefault();
handleLogout();
}}
>
Sign Out
</NavigationMenuLink>
```
```tsx
// External link with icon
<NavigationMenuLink href="https://github.com" target="_blank" rel="noopener">
<GitHubIcon className="size-4" />
GitHub
<ExternalLinkIcon className="size-3 ml-auto" />
</NavigationMenuLink>
```
**Type**: component
NavigationMenuLink - Styled link component