Components
Text link
Text that goes somewhere or does something, with no button shape round it.
import { ArrowRight } from 'lucide-react'
import { TextLink } from '@dex/shared/components/text-link'
export function TextLinkVariants() {
return (
<>
<TextLink href="/overview/colour">Colour</TextLink>
<p className="text-sm text-muted-foreground">
The mark is a sun rising, never setting.{' '}
<TextLink href="/overview/rationale" variant="inline">
Read the rationale
</TextLink>
</p>
<TextLink href="/components/button" variant="foreground">
Button
</TextLink>
<TextLink href="/overview/logo" variant="brand">
Every logo file
<ArrowRight />
</TextLink>
</>
)
}
Didn’t get it?
'use client'
import { useState } from 'react'
import { TextLink } from '@dex/shared/components/text-link'
export function TextLinkAction() {
const [isSending, setIsSending] = useState(false)
return (
<>
<TextLink onClick={() => window.alert('Cookie settings')}>Manage cookies</TextLink>
<p className="text-sm text-muted-foreground">
Didn’t get it?{' '}
<TextLink
variant="inline"
disabled={isSending}
onClick={() => {
setIsSending(true)
window.setTimeout(() => setIsSending(false), 1500)
}}
>
Resend the link
</TextLink>
</p>
</>
)
}
import { ArrowUpRight } from 'lucide-react'
import { TextLink } from '@dex/shared/components/text-link'
export function TextLinkExternal() {
return (
<>
<TextLink href="https://www.linkedin.com/company/meetdex">
LinkedIn
<ArrowUpRight />
</TextLink>
<TextLink href="/resources/logos/dex-client-logos.zip" external>
Client logos
<ArrowUpRight />
</TextLink>
</>
)
}
With the app's router
render draws it as the app’s own link, so the page loads without a full reload. An app can wrap this once, as the website’s components/ui/link.tsx does. See also Button.import NextLink from 'next/link'
import { TextLink } from '@dex/shared/components/text-link'
export function TextLinkRouterLink() {
return <TextLink render={<NextLink href="/components/button" />}>Button</TextLink>
}
- A text link has no padding or height of its own, so it sits in a line of copy, a footer or a nav. Anything with a button's height is a Button, including its
linkvariant. mutedis the default, for footers, navs and secondary actions. Inside muted copy useinline, which is underlined at rest so it still reads as a link.brandis the one orange link in a view, leading into the main conversion. Everything else is muted.- With no
hrefit draws a button, for an action such as opening a dialog. Don't give it anhrefof#to make it clickable. - An arrow after the label: → for a page on this site, ↗ only for a link that opens a new tab.