Vesyl UI

ButtonLink

A real <a> that looks like a Button. It wraps an anchor with TanStack Router’s createLink, so it shares Button’s variants and sizes but navigates instead of firing an onClick.

Reach for ButtonLink whenever a button-styled control should change the route — a “View order” call to action, an “Add store” header action, a back link. Use Button for actions that don’t navigate (submit, open a dialog, mutate). Because it renders an anchor, it gets browser link behavior for free: right-click to open in a new tab, middle-click, copy address.

Default

Pass to, params, and search directly — they’re fully typed against the consumer’s route tree. Always route dynamic segments through params (e.g. to="/orgs/$orgSlug" params={{ orgSlug }}) rather than interpolating into the path string; interpolation skips type checking and silently breaks when a route changes.

Variants

variant maps 1:1 to Buttondefault, secondary, outline, ghost, destructive, and link. Plain string hrefs work too when you’re linking outside the router (external URLs, anchors).

Sizes

size matches Button: md (default), xs, sm, and lg control height, padding, and text size.

With icons

Mark a leading or trailing lucide icon with data-icon="inline-start" / data-icon="inline-end" so it picks up the correct gap and edge padding — the same convention as Button.

Reference

An <a> styled with buttonVariants, wrapped in TanStack Router’s createLink. Accepts every Link prop (to, params, search, from, hash, replace, …) plus the variant props below, and any native <a> attribute such as href or target.

PropTypeDefaultDescription
toroute pathTypesafe destination route (preferred over href)
paramsobjectValues for dynamic segments in to
searchobjectQuery-string params, typed against the route
hrefstringNative anchor target for external / non-router links
variant"default" | "secondary" | "outline" | "ghost" | "destructive" | "link""default"Visual style; mirrors Button
size"md" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""md"Height, padding, and text size; mirrors Button
classNamestringMerged onto the anchor