Link

Link is an accessible element for navigation.

Source@chakra-ui/layout

Imports#

import { Link } from '@chakra-ui/react'

Usage#

<Link>Chakra UI</Link>

To use the link as an external link, pass the external prop. This will add the target='_blank' and rel='noopener noreferrer' attributes to the link.

<Link href='https://chakra-ui.com' external>
Chakra UI
</Link>

Pass the variant prop to change the style of the link.

<HStack>
<Link variant='underline' href='#'>
Chakra UI Docs
</Link>
<Link variant='plain' href='#'>
Chakra UI Docs
</Link>
</HStack>

Usage with Routing Library#

Use the asChild when you need to compose the link with those from Next.js or React Router.

import NextLink from 'next/link'
import { Link } from '@chakra-ui/react'
function Demo() {
return (
<Link asChild>
<NextLink href='/home'>Home</NextLink>
</Link>
)
}
Edit this page on GitHub

Proudly made inNigeria by Segun Adebayo

Deployed by â–² Vercel