link-button.tsx raw
1 import type { VariantProps } from "class-variance-authority";
2 import * as React from "react";
3 import { Link } from "react-router";
4 import { cn } from "src/lib/utils";
5 import { buttonVariants } from "../buttonVariants";
6
7 export function LinkButton({
8 className,
9 variant,
10 size,
11 to,
12 children,
13 ...props
14 }: React.PropsWithChildren<
15 VariantProps<typeof buttonVariants> & {
16 to: string;
17 className?: string;
18 }
19 >) {
20 return (
21 <Link
22 to={to}
23 className={cn(buttonVariants({ variant, size, className }))}
24 {...props}
25 data-slot="button"
26 data-variant={variant ?? "default"}
27 >
28 {children}
29 </Link>
30 );
31 }
32