BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/solid-ui/button

Button

solid-ui/button
FreeComponent

A button component

Live preview

live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.solid-ui.com/r/button.json

Source

src/registry/ui/button.tsxwww.solid-ui.com/r/button.json
1import type { JSX, ValidComponent } from "solid-js"
2import { splitProps } from "solid-js"
3
4import * as ButtonPrimitive from "@kobalte/core/button"
5import type { PolymorphicProps } from "@kobalte/core/polymorphic"
6import type { VariantProps } from "class-variance-authority"
7import { cva } from "class-variance-authority"
8
9import { cn } from "~/lib/utils"
10
11const buttonVariants = cva(
12 "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
13 {
14 variants: {
15 variant: {
16 default: "bg-primary text-primary-foreground hover:bg-primary/90",
17 destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
18 outline: "border border-input hover:bg-accent hover:text-accent-foreground",
19 secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
20 ghost: "hover:bg-accent hover:text-accent-foreground",
21 link: "text-primary underline-offset-4 hover:underline"
22 },
23 size: {
24 default: "h-10 px-4 py-2",
25 sm: "h-9 px-3 text-xs",
26 lg: "h-11 px-8",
27 icon: "size-10"
28 }
29 },
30 defaultVariants: {
31 variant: "default",
32 size: "default"
33 }
34 }
35)
36
37type ButtonProps<T extends ValidComponent = "button"> = ButtonPrimitive.ButtonRootProps<T> &
38 VariantProps<typeof buttonVariants> & { class?: string | undefined; children?: JSX.Element }
39
40const Button = <T extends ValidComponent = "button">(
41 props: PolymorphicProps<T, ButtonProps<T>>
42) => {
43 const [local, others] = splitProps(props as ButtonProps, ["variant", "size", "class"])
44 return (
45 <ButtonPrimitive.Root
46 class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}
47 {...others}
48 />
49 )
50}
51
52export { Button, buttonVariants }
53export type { ButtonProps }

What it pulls in

npm packages

  • @kobalte/core
  • class-variance-authority
  • solid-js

Files it writes

  • src/registry/ui/button.tsx

Facts

Registry
solid-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on solid-ui www.solid-ui.com stefan-karger/solid-ui on GitHub Raw registry item This item as JSON

More from solid-ui

All 55 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionsolid-uiComponentsFree2 deps
Alertalertsolid-uiComponentsFree3 deps
Alert Dialogalert-dialogsolid-uiComponentsFree2 deps
Aspect Ratioaspect-ratiosolid-uiComponentsFree1 dep
Avataravatarsolid-uiComponentsFree2 deps
Badgebadgesolid-uiComponentsFree2 deps
Badge Deltabadge-deltasolid-uiComponentsFree2 deps
Bar Listbar-listsolid-uiComponentsFree1 dep
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