Files
shadcn-ui/apps/v4/components/open-in-v0-button.tsx
shadcn 19d7fbb731 Use v4 blocks for Open in v0 (#7898)
* feat(www): use v4 blocks for v0

* fix: defaultIndex
2025-07-27 11:34:07 +04:00

31 lines
711 B
TypeScript

import { cn } from "@/lib/utils"
import { Icons } from "@/components/icons"
import { Button } from "@/registry/new-york-v4/ui/button"
// v0 uses the default style.
const V0_STYLE = "new-york-v4"
export function OpenInV0Button({
name,
className,
...props
}: React.ComponentProps<typeof Button> & {
name: string
}) {
return (
<Button
size="sm"
asChild
className={cn("h-[1.8rem] gap-1", className)}
{...props}
>
<a
href={`${process.env.NEXT_PUBLIC_V0_URL}/chat/api/open?url=${process.env.NEXT_PUBLIC_APP_URL}/r/styles/${V0_STYLE}/${name}.json`}
target="_blank"
>
Open in <Icons.v0 className="size-5" />
</a>
</Button>
)
}