Warcraft Button
warcraftcn/buttonFreeComponent
A Warcraft-themed button component with fantasy styling
Live preview
live · rendered by the registry
Rendered by warcraftcn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.warcraftcn.com/r/button.jsonSource
1import { Slot } from "@radix-ui/react-slot";2import { cva, type VariantProps } from "class-variance-authority";3import type * as React from "react";45import { cn } from "@/lib/utils";67import "@/components/ui/warcraftcn/styles/warcraft.css";89const buttonVariants = cva(10 "fantasy inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-all duration-100 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 active:scale-95 active:brightness-75 active:shadow-inner",11 {12 variants: {13 variant: {14 default:15 "bg-center px-5 py-4 bg-cover bg-no-repeat text-white hover:brightness-110",16 frame:17 "bg-center bg-cover bg-no-repeat text-white hover:brightness-110",18 },19 },20 defaultVariants: {21 variant: "default",22 },23 }24);2526function Button({27 className,28 variant,29 asChild = false,30 style,31 ...props32}: React.ComponentProps<"button"> &33 VariantProps<typeof buttonVariants> & {34 asChild?: boolean;35 }) {36 const Comp = asChild ? Slot : "button";37 const borderImageClass =38 variant === "frame" ? "wc-btn-border-frame" : "wc-btn-border";3940 return (41 <Comp42 className={cn(43 buttonVariants({ variant }),44 "border-solid [border-image-repeat:stretch] border-5 [border-image-slice:16_fill]",45 borderImageClass,46 className47 )}48 style={style}49 data-slot="button"50 {...props}51 />52 );53}5455export { Button, buttonVariants };
Files it writes
More from warcraftcn
All 16 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Warcraft Accordionaccordion | warcraftcn | Components | Free | 1 dep · 7 files | |
| Warcraft Avataravatar | warcraftcn | Components | Free | no deps · 7 files | |
| Warcraft Badgebadge | warcraftcn | Components | Free | no deps · 4 files | |
| Warcraft Cardcard | warcraftcn | Components | Free | no deps · 3 files | |
| Warcraft Checkboxcheckbox | warcraftcn | Components | Free | 1 dep · 12 files | |
| Warcraft Cursorcursor | warcraftcn | Components | Free | no deps · 6 files | |
| Warcraft Dropdown Menudropdown-menu | warcraftcn | Components | Free | 2 deps · 3 files | |
| Warcraft Inputinput | warcraftcn | Components | Free | no deps · 3 files |
