BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/cubby-ui/button

Button

cubby-ui/button
FreeComponent

A simple 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/button.json

Source

registry/default/button/button.tsxcubby-ui.dev/r/button.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { cva, type VariantProps } from "class-variance-authority";
5import { Button as BaseButton } from "@base-ui/react/button";
6import { HugeiconsIcon } from "@hugeicons/react";
7import { Loading03Icon } from "@hugeicons/core-free-icons";
8import { cn } from "@/lib/utils";
9
10// The button's fill and border render on a ::before pseudo-element that
11// scales down on press (the pill shrinks, the label stays put). Because the
12// pseudo travels with the classes, every consumer of the recipe — <Button>
13// and flat elements styled via `buttonVariants` (pagination links, calendar
14// nav, toolbar buttons) — gets identical paint and press behavior with no
15// extra DOM. ButtonGroup collapses borders between segments with `before:`
16// rules, inert on children that don't carry the recipe.
17//
18// Paint: variants set per-state tokens (--btn-bg, --btn-bg-hover,
19// --btn-bg-active, --btn-border), the state machine below resolves them into
20// --btn-paint, and buttonPaint renders it on the pseudo (custom properties
21// inherit into pseudo-elements). Consumers recolor by overriding the tokens
22// (className="[--btn-bg:...]") and restyle the border via `before:` classes
23// (className="before:border-dashed").
24const buttonBase = cn(
25 "relative isolate inline-flex items-center cursor-pointer justify-center whitespace-nowrap rounded-lg font-medium data-disabled:pointer-events-none data-disabled:opacity-60 data-disabled:focus-visible:outline-ring [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 focus-visible:outline-ring/50 outline-0 outline-offset-0 outline-transparent transition-[outline-width,outline-offset,outline-color,scale,opacity,background-color,color] duration-100 ease-out outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 aria-invalid:outline-destructive/50 aria-invalid:outline-2 aria-invalid:outline-offset-2 aria-invalid:outline-solid",
26 // State machine: unset tokens fall through to transparent. Pressing shows
27 // the active paint — except on popup triggers (aria-haspopup), which skip
28 // pressed feedback entirely (mirroring the press-scale guard) and simply
29 // hold their hover paint while open (data-popup-open, stamped by Base UI).
30// … truncated

What it pulls in

npm packages

  • class-variance-authority
  • @hugeicons/react
  • @hugeicons/core-free-icons

Files it writes

  • registry/default/button/button.tsx

Facts

Registry
cubby-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on cubby-ui cubby-ui.dev joncoronel/cubby-ui on GitHub Raw registry item This item as JSON

More from cubby-ui

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordioncubby-uiComponentsFree2 deps
Alertalertcubby-uiComponentsFree1 dep
Alert-dialogalert-dialogcubby-uiComponentsFree2 deps
Aspect-ratioaspect-ratiocubby-uiComponentsFreeno deps
Autocompleteautocompletecubby-uiComponentsFree2 deps
Avataravatarcubby-uiComponentsFree1 dep
Badgebadgecubby-uiComponentsFree1 dep
Base Drawerbase-drawercubby-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex