Button
scificn/buttonFreeComponent
Terminal-style action button with EXEC, GHOST, OUTLINE, and ABORT variants.
Live preview
live · rendered by the registry
Rendered by scificn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.scificn.dev/r/button.jsonSource
1import * as React from 'react'2import { Slot } from '@radix-ui/react-slot'3import { cva, type VariantProps } from 'class-variance-authority'4import { cn } from '@/lib/utils'56const buttonVariants = cva(7 [8 'inline-flex items-center justify-center',9 'font-mono font-medium uppercase tracking-widest',10 'border border-solid',11 'cursor-pointer select-none',12 'transition-all duration-150',13 'focus-visible:outline-none',14 'disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none',15 'rounded-none',16 'whitespace-nowrap',17 ],18 {19 variants: {20 variant: {21 EXEC: [22 'bg-transparent',23 'border-[var(--color-green)]',24 'text-[var(--color-green)]',25 'hover:bg-[var(--color-green)]',26 'hover:text-[var(--color-bg)]',27 'hover:shadow-[var(--glow-green)]',28 'focus-visible:shadow-[var(--glow-green)]',29 ],30 GHOST: [31 'bg-transparent',32 'border-transparent',33 'text-[var(--text-secondary)]',34 'hover:text-[var(--color-green)]',35 'hover:border-[var(--border)]',36 'focus-visible:border-[var(--border)]',37 ],38 OUTLINE: [39 'bg-[var(--surface)]',40 'border-[var(--border)]',41 'text-[var(--text-secondary)]',42 'hover:border-[var(--border-active)]',43 'hover:text-[var(--color-green)]',44 'hover:shadow-[var(--glow-green)]',45 'focus-visible:border-[var(--border-active)]',46 'focus-visible:shadow-[var(--glow-green)]',47 ],48 ABORT: [49 'bg-transparent',50 'border-[var(--color-red)]',51 'text-[var(--color-red)]',52 'hover:bg-[var(--color-red)]',53 'hover:text-[var(--color-bg)]',54 'hover:shadow-[var(--glow-red)]',55 'focus-visible:shadow-[var(--glow-red)]',56 ],57 },58 size: {59 SM: 'h-7 px-3 text-[0.65rem] gap-1.5',60 MD: 'h-9 px-4 text-[0.75rem] gap-2',61 LG: 'h-11 px-6 text-[0.875rem] gap-2.5',62 },63 },64 defaultVariants: {65 variant: 'OUTLINE',66 size: 'MD',67 },68 }69)7071export interface ButtonProps72 extends React.ButtonHTMLAttributes<HTMLButtonElement>,73 VariantProps<typeof buttonVariants> {74 asChild?: boolean75}7677const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(78 ({ className, variant, size, asChild = false, ...props }, ref) => {79 const Comp = asChild ? Slot : 'button'80// … truncated
What it pulls in
npm packages
More from scificn
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | scificn | Components | Free | 1 dep | |
| Badgebadge | scificn | Components | Free | 1 dep | |
| Bar Chartbar-chart | scificn | Components | Free | no deps | |
| Breadcrumbbreadcrumb | scificn | Components | Free | no deps | |
| Cardcard | scificn | Components | Free | no deps | |
| Checkboxcheckbox | scificn | Components | Free | 1 dep | |
| Dialogdialog | scificn | Components | Free | 1 dep | |
| Gridgrid | scificn | Components | Free | no deps |
