JGuang / JGuang UI
Components组件Radix UIRadix UI 组件

Button

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

Partially translated: Chinese navigation, titles, descriptions, and common headings. The technical body is currently in English.
Loading JGuang UI example…

Installation

Command

Manual

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

Install the following dependencies:

npm install radix-ui

Copy and paste the following code into your project.

View complete source: components/ui/button.tsx

Update the import paths to match your project setup.

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 JGuang UI Registry.

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

Size

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

Loading JGuang UI example…

Default

Loading JGuang UI example…

Outline

Loading JGuang UI example…

Secondary

Loading JGuang UI example…

Ghost

Loading JGuang UI example…

Destructive

Loading JGuang UI example…
Loading JGuang UI example…

Icon

Loading JGuang UI example…

With Icon

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

Loading JGuang UI example…

Rounded

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

Loading JGuang UI example…

Spinner

Render a `` 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 JGuang UI example…

Button Group

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

Loading JGuang UI example…

As Child

You can use the asChild prop on `` to make another component look like a button. Here's an example of a link that looks like a button.

Loading JGuang UI example…

RTL

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

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"
asChildbooleanfalse

Source: components/radix/button.mdx

Technical documentation for JGuang UI.

On this page