Fancy Button
cubby-ui/fancy-buttonFreeComponent
A fancy-button component.
Live preview
live · rendered by the registry
Rendered by cubby-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://cubby-ui.dev/r/fancy-button.jsonSource
1"use client";23import * as React from "react";4import { cva, type VariantProps } from "class-variance-authority";5import { Button as BaseButton } from "@base-ui/react/button";6import { cn } from "@/lib/utils";78// Intentionally non-themeable: hardcoded OKLCH values because this renders as9// a dark glossy button in both light AND dark — it can't map to --neutral,10// which inverts to near-white in dark mode.11const fancyButtonVariants = cva(12 "relative inline-flex cursor-pointer items-center justify-center whitespace-nowrap text-sm font-medium transition-[color,background-color,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,transform,scale,opacity,outline-width,outline-offset,outline-color] outline-0 outline-offset-0 outline-transparent disabled:pointer-events-none disabled:opacity-60 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 rounded-lg active:scale-[0.98] focus-visible:outline-ring/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid",13 {14 variants: {15 variant: {16 default:17 "bg-[oklch(0.3_0_0)] hover:bg-[oklch(0.35_0_0)] dark:hover:bg-[oklch(0.22_0_0)] dark:bg-[oklch(0.2_0_0)] text-primary-foreground ring-1 ring-[oklch(0.15_0_0)] dark:text-secondary-foreground shadow-[inset_0_1px_1px_oklch(1_0_0_/_0.2),0_1px_2px_0_oklch(0.1_0_0_/_0.07)]",18 custom:19 "shadow-[inset_0_1px_1px_oklch(1_0_0_/_0.4),0_1px_2px_0_oklch(0.1_0_0_/_0.07),inset_0_-0.5px_1px_oklch(0_0_0_/_0.1)] dark:shadow-[inset_0_1px_1px_oklch(1_0_0_/_0.2),0_1px_2px_0_oklch(0.1_0_0_/_0.07),inset_0_-1px_1px_oklch(0_0_0_/_0.1)] text-white ring-1 hover:opacity-90",20 },21 size: {22 default: "h-10 sm:h-9 px-3 py-2 gap-1",23 xs: "h-8 sm:h-7 px-2 py-1.5 gap-0.5 text-xs rounded-md",24 sm: "h-9 sm:h-8 px-2 py-1.5 gap-0.5",25 lg: "h-11 sm:h-10 px-3.5 py-2.5 gap-1",26 icon: "size-10 sm:size-9",27 icon_xs: "size-8 sm:size-7 rounded-md",28 icon_sm: "size-9 sm:size-8",29 icon_lg: "size-11 sm:size-10",30 },31 },32 defaultVariants: {33 variant: "default",34 size: "default",35 },36 },37);3839type FancyButtonProps = BaseButton.Props &40 VariantProps<typeof fancyButtonVariants> & {41 color?: string;42 leftSection?: React.ReactNode;43 rightSection?: React.ReactNode;44 };4546export const FancyButton = ({47 children,48 size,49 color,50 leftSection,51 rightSection,52// … truncated
What it pulls in
npm packages
Files it writes
More from cubby-ui
All 79 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | cubby-ui | Components | Free | 2 deps | |
| Alertalert | cubby-ui | Components | Free | 1 dep | |
| Alert-dialogalert-dialog | cubby-ui | Components | Free | 2 deps | |
| Aspect-ratioaspect-ratio | cubby-ui | Components | Free | no deps | |
| Autocompleteautocomplete | cubby-ui | Components | Free | 2 deps | |
| Avataravatar | cubby-ui | Components | Free | 1 dep | |
| Badgebadge | cubby-ui | Components | Free | 1 dep | |
| Base Drawerbase-drawer | cubby-ui | Components | Free | 2 deps |
