Link Button
LinkButton preserves link semantics while applying button-like styling for navigation actions that need stronger visual emphasis.
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
<LinkButton href="#invoices">
View invoice
</LinkButton>Installation
pnpm dlx wideset add link-button
Copies the component and any Wideset components it uses into your project.
Examples
Variants
A link button navigates; it renders an <a>, so it opens in a new tab and shows its address like any link. Primary is the main route out of a view, secondary a supporting one. Danger leads somewhere risky, such as account deletion; success to the next step after a win. Inverse is for dark or coloured surfaces.
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
export default function LinkButtonVariants() {
return (
<div className="gap-ws-12 flex flex-wrap items-center">
<LinkButton variant="primary" href="#invoices">
View invoices
</LinkButton>
<LinkButton variant="secondary" href="#settings">
Billing settings
</LinkButton>
<LinkButton variant="danger" href="#delete-account">
Delete account
</LinkButton>
<LinkButton variant="success" href="#next-steps">
See next steps
</LinkButton>
<div className="bg-ws-static-inverse-background rounded-ws-container-md p-ws-8">
<LinkButton variant="inverse" href="#pricing">
Compare plans
</LinkButton>
</div>
</div>
);
}Sizes
Small is the default and sits in body text, cards and table rows. Large sets a bigger label for a standalone route that needs more presence, such as the link under a form. Both sizes are the same height.
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
export default function LinkButtonSizes() {
return (
<div className="gap-ws-12 flex flex-wrap items-center">
{(['sm', 'lg'] as const).map((size) => (
<LinkButton key={size} size={size} href="#invoices">
View invoices
</LinkButton>
))}
</div>
);
}Underlined
Off by default, since a link button usually stands on its own. Turn the underline on when the link sits inside a sentence, where colour alone does not tell it apart from the text around it.
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
export default function LinkButtonUnderlined() {
return (
<div className="gap-ws-12 flex flex-wrap items-center">
<LinkButton href="#invoices">View invoice</LinkButton>
<LinkButton href="#invoices" underlined>
View invoice
</LinkButton>
</div>
);
}States
Hover, press and keyboard focus are live. A link has no native disabled state, so disabled sets aria-disabled, removes it from the tab order and cancels the click. Use it only while the destination is temporarily unavailable; otherwise hide the link.
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
export default function LinkButtonStates() {
return (
<div className="gap-ws-12 flex flex-wrap items-center">
<LinkButton href="#report">Download report</LinkButton>
<LinkButton href="#report" disabled>
Download report
</LinkButton>
</div>
);
}API reference
LinkButton
| Name | Description | Default |
|---|---|---|
asChild | Whether to render the link button styling onto its child element via Radix Slot. boolean | — |
children | Link label or custom content rendered inside the root. ReactNode | — |
className | Additional CSS classes merged with the link button root. string | — |
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
disabled | Disabled state that prevents interaction and marks the control as aria-disabled. boolean | — |
href | Destination URL used when rendering a native anchor. string | — |
onClick | Called when the user activates the link button. MouseEventHandler<HTMLAnchorElement> | — |
size | 'sm''lg' | 'sm' |
underlined | Renders the label with an underline. Off by default. boolean | false |
variant | 'primary''secondary''danger''success''inverse' | 'primary' |
<a> is passed through to it. See MDN: <a>.LinkButton.TruncatedText
Accessibility
- It is a link: it can be opened in a new tab and shows its address like any link. Do not use it with
only
onClickand nohref. - Disabled is announced through
aria-disabled; there is no native disabled on<a>.
| Part | Renders | Description |
|---|---|---|
| LinkButtonRenders no element | <a> | A navigation link styled as a button. |
| LinkButton.TruncatedTextRenders no element | — | `LinkButton.TruncatedText` is `Button.TruncatedText`; same props. |
import { LinkButton } from '@/components/ui/wideset/button/LinkButton';
<LinkButton href="#invoices">
View invoice
</LinkButton>