Button
roi-ui/buttonFreeItem
A button component.
Install it
npx shadcn@latest add https://roiui.com/r/button.jsonSource
1"use client";23import { Button as ButtonPrimitive } from "@base-ui/react/button";4import { cva, type VariantProps } from "class-variance-authority";56import { cn } from "@/lib/utils";7import styles from "./button.module.css";89const buttonVariants = cva(styles.base, {10 variants: {11 variant: {12 primary: styles.primary,13 secondary: styles.secondary,14 destructive: styles.destructive,15 ghost: styles.ghost,16 outline: styles.outline,17 link: styles.link,18 },19 size: {20 sm: styles.sm,21 md: styles.md,22 lg: styles.lg,23 icon: styles.icon,24 },25 },26 defaultVariants: {27 variant: "primary",28 size: "md",29 },30});3132function Spinner() {33 return (34 <svg className={styles.spinner} fill="none" height="16" viewBox="0 0 24 24" width="16">35 <circle36 cx="12"37 cy="12"38 r="10"39 stroke="currentColor"40 strokeDasharray="31.416"41 strokeDashoffset="31.416"42 strokeLinecap="round"43 strokeWidth="2"44 />45 </svg>46 );47}4849function ArrowPointer({ pointLeft = false, pointExternal = false }: { pointLeft?: boolean; pointExternal?: boolean }) {50 return (51 <svg52 className={cn(styles.arrow, pointLeft && styles.arrowLeft, pointExternal && styles.arrowExternal)}53 data-slot="arrow"54 fill="none"55 viewBox="0 0 14 10"56 xmlns="http://www.w3.org/2000/svg"57 >58 <g>59 <path60 className={styles.arrowPoint}61 d={pointLeft ? "M14.8 1l-4 4 4 4" : "M-0.8 1l4 4-4 4"}62 fill="none"63 stroke="currentColor"64 strokeLinecap="square"65 strokeLinejoin="miter"66 strokeWidth="2"67 />68 <path69 className={styles.arrowShaft}70 d={pointLeft ? "M14.8 5H9.8" : "M0 5h4.8"}71 fill="none"72 stroke="currentColor"73 strokeLinecap="square"74 strokeLinejoin="miter"75 strokeWidth="2"76 />77 </g>78 </svg>79 );80}8182function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {83 return <ButtonPrimitive className={cn(buttonVariants({ variant, size, className }))} data-slot="button" {...props} />;84}8586export { Button, buttonVariants, Spinner, ArrowPointer };
What it pulls in
npm packages
Files it writes
More from Roi UI
All 123 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Roi UI | Other | Free | no deps · 2 files | |
| Accordion (Tailwind)accordion-tailwind | Roi UI | Other | Free | no deps | |
| AI Chatai-chat | Roi UI | Other | Free | no deps · 2 files | |
| AI Chat (Tailwind)ai-chat-tailwind | Roi UI | Other | Free | no deps | |
| Alertalert | Roi UI | Other | Free | 1 dep · 2 files | |
| Alert Dialogalert-dialog | Roi UI | Other | Free | no deps · 2 files | |
| Alert Dialog (Tailwind)alert-dialog-tailwind | Roi UI | Other | Free | no deps | |
| Alert (Tailwind)alert-tailwind | Roi UI | Other | Free | 1 dep |
