StatsHub Docs
PlaygroundWebComponents

Button

Displays a button or a component that looks like a button.

StatsHub stories

Button

shadcn previews

Loading…
import { ArrowUpIcon } from "lucide-react";import { Button } from "@statshub/ui-web/components/button";

Installation

Usage

import { Button } from "@/components/ui/button"
<Button variant="outline">Button</Button>

Cursor

Tailwind v4 switched from cursor: pointer to cursor: default for the button component.

If you want to keep the cursor: pointer behavior, add the following code to your CSS file:

You can also enable this during project setup with npx shadcn@latest init --pointer.

globals.css
@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

Size

Use the size prop to change the size of the button.

Loading…
import { ArrowUpRightIcon } from "lucide-react";import { Button } from "@statshub/ui-web/components/button";

Default

Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonDefault() {

Outline

Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonOutline() {

Secondary

Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonSecondary() {

Ghost

Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonGhost() {

Destructive

Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonDestructive() {
Loading…
import { Button } from "@statshub/ui-web/components/button";export default function ButtonLink() {

Icon

Loading…
import { CircleFadingArrowUpIcon } from "lucide-react";import { Button } from "@statshub/ui-web/components/button";

With Icon

Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the icon for the correct spacing.

Loading…
import { IconGitBranch, IconGitFork } from "@tabler/icons-react";import { Button } from "@statshub/ui-web/components/button";

Rounded

Use the rounded-full class to make the button rounded.

Loading…
import { ArrowUpIcon } from "lucide-react";import { Button } from "@statshub/ui-web/components/button";

Spinner

Render a <Spinner /> component inside the button to show a loading state. Remember to add the data-icon="inline-start" or data-icon="inline-end" attribute to the spinner for the correct spacing.

Loading…
import { Button } from "@statshub/ui-web/components/button";import { Spinner } from "@statshub/ui-web/components/spinner";

Button Group

To create a button group, use the ButtonGroup component. See the Button Group documentation for more details.

Loading…
"use client";import * as React from "react";

You can use the buttonVariants helper to make a link look like a button.

Do not use <Button render={<a />} nativeButton={false} /> for links. The Base UI Button component always applies role="button", which overrides the semantic link role on <a> elements. Use buttonVariants with a plain <a> tag instead.

Loading…
import { buttonVariants } from "@statshub/ui-web/components/button";export default function ButtonRender() {

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

Loading…
"use client";import { ArrowRightIcon, PlusIcon } from "lucide-react";

API Reference

Button

The Button component is a wrapper around the button element that adds a variety of styles and functionality.

PropTypeDefault
variant"default" | "outline" | "ghost" | "destructive" | "secondary" | "link""default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"

On this page