mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-29 23:55:02 +00:00
docs: fix next/link import syntax in component examples (#8427)
Fix incorrect named import syntax for Next.js Link component.
Changed from:
import { Link } from "next/link"
To correct default import:
import Link from "next/link"
Next.js Link is a default export, not a named export. The incorrect
syntax causes TypeScript error:
'Module "next/link" has no exported member "Link"'
Affected files:
- Button component docs
- Badge component docs
- Breadcrumb component docs (v4 and www)
- Navigation Menu component docs
Fixes issue where users copying code snippets get immediate errors.
Co-authored-by: serhatx1 <armonikadijital@gmail.com>
This commit is contained in:
@@ -57,7 +57,7 @@ import { Badge } from "@/components/ui/badge"
|
||||
You can use the `asChild` prop to make another component look like a badge. Here's an example of a link that looks like a badge.
|
||||
|
||||
```tsx showLineNumbers
|
||||
import { Link } from "next/link"
|
||||
import Link from "next/link"
|
||||
|
||||
import { Badge } from "@/components/ui/badge"
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ To use a custom link component from your routing library, you can use the `asChi
|
||||
/>
|
||||
|
||||
```tsx showLineNumbers {1,8-10}
|
||||
import { Link } from "next/link"
|
||||
import Link from "next/link"
|
||||
|
||||
...
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ To create a button group, use the `ButtonGroup` component. See the [Button Group
|
||||
You can use the `asChild` prop to make another component look like a button. Here's an example of a link that looks like a button.
|
||||
|
||||
```tsx showLineNumbers
|
||||
import { Link } from "next/link"
|
||||
import Link from "next/link"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ import {
|
||||
You can use the `asChild` prop to make another component look like a navigation menu trigger. Here's an example of a link that looks like a navigation menu trigger.
|
||||
|
||||
```tsx showLineNumbers title="components/example-navigation-menu.tsx"
|
||||
import { Link } from "next/link"
|
||||
import Link from "next/link"
|
||||
|
||||
export function NavigationMenuDemo() {
|
||||
return (
|
||||
|
||||
@@ -181,7 +181,7 @@ To use a custom link component from your routing library, you can use the `asChi
|
||||
/>
|
||||
|
||||
```tsx showLineNumbers {1,8-10}
|
||||
import { Link } from "next/link"
|
||||
import Link from "next/link"
|
||||
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user