---
localeCode: en-US
order: 16
category: Input
title: Button
subTitle: Button
icon: doc-button
dir: column
brief: Users use buttons to trigger an operation or jump.
---
## Demos
### How to import
```jsx import
import { Button, SplitButtonGroup } from '@douyinfe/semi-ui';
```
### Button Type
Buttons support the following types:
- Primary button ("primary", default)
- Secondary button ("secondary")
- Tertiary button ("tertiary")
- Warning button ("warning")
- Danger button ("danger")
> Primary and Secondary button have the same colors in Semi's default theme, but you can implement different Primary and Secondary colors by customizing the theme.
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
function ButtonDemo() {
return (
);
}
```
#### About the Font Color
[CSS Variables](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) are used with the button:
- `var(--semi-color-primary)`: main
- `var(--semi-color-secondary)`: secondary
- `var(--semi-color-colored)`: third
- `var(--semi-color-warning)`: warning
- `var(--semi-color-danger)`: danger
You can define your elements directly using these theme colors.
```jsx live=true dir="column"
import React from 'react';
function ButtonDemo() {
const types = [['primary', 'primary'], ['secondary', 'secondary'], ['tertiary', 'tertiary'], ['warning', 'warning'], ['danger', 'danger']];
return (
{types.map((type, index) => (
{Array.isArray(type) ? type[1]: type}
))}
);
}
```
### Button Theme
The themes currently available are:
- `light`: light background
- `solid`: dark background
- `borderless`: no background
The default theme is `light`
#### Light Background
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
function ButtonDemo() {
const themes = [['light', 'light']];
const types = [['primary', 'primary'], ['secondary', 'secondary'], ['tertiary', 'tertiary'], ['warning', 'warning'], ['danger', 'danger']];
return (
);
}
```
### Size
Three sizes are defined by default:
- Big: "Large"
- Default: "default."
- Small: "Small"
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
function ButtonDemo() {
return (
);
}
```
### Block Button
The block button has a predefined width, and its width is independent of the width of the contents of the button.
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
function ButtonDemo() {
return (
);
}
```
### Icon Button
An icon that defines a button.
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
import { IconCamera, IconSidebar, IconChevronDown } from '@douyinfe/semi-icons';
function ButtonDemo() {
return (
);
}
```
### Link Button
We recommend using Typography to achieve link text button. Refer to [Typography](/en-US/basic/typography) for more information.
```jsx live=true
import React from 'react';
import { Typography } from '@douyinfe/semi-ui';
import { IconLink } from '@douyinfe/semi-icons';
function Demo() {
const { Text } = Typography;
return (
Link
Open Website
} underline>Link
);
}
```
### Prohibited Status
```jsx live=true dir="column"
import React from 'react';
import { Button } from '@douyinfe/semi-ui';
function ButtonDemo() {
return (
);
}
```
### Loading State
The button supports the Loading state, by setting the loading parameter value to true, note: the state priority is higher than the loading state.
```jsx live=true dir="column"
import React, { useState } from 'react';
import { Button } from '@douyinfe/semi-ui';
import { IconDelete } from '@douyinfe/semi-icons';
function ButtonDemo() {
const [saveLoading, setSaveLoading] = useState(false);
const [delLoading, setDelLoading] = useState(true);
const [repLoading, setRepLoading] = useState(true);
const reset = status => {
status = !!status;
setSaveLoading(status);
setDelLoading(status);
setRepLoading(status);
};
return (
);
}
```
### Button Combination
You can put multiple buttons in `ButtonGroup` In the container, by setting `size`, `disabled`, `type` You can uniformly set the button size in the button combination, whether disabled and type.
#### Combined Dimensions
```jsx live=true dir="column"
import React from 'react';
import { Button, ButtonGroup } from '@douyinfe/semi-ui';
function ButtonDemo() {
const sizes = ['large', 'default', 'small'];
return (
{sizes.map(size => (
))}
);
}
```
#### Combined Disabled
```jsx live=true dir="column"
import React from 'react';
import { Button, ButtonGroup } from '@douyinfe/semi-ui';
function ButtonDemo() {
return (
);
}
```
#### Combined Type
```jsx live=true dir="column"
import React from 'react';
import { Button, ButtonGroup } from '@douyinfe/semi-ui';
function ButtonDemo() {
const types = ['primary', 'secondary', 'tertiary', 'warning', 'danger'];
return (
{types.map(type => (
))}
);
}
```
### Split Button Group
**V1.12.0**
In the scene where `Button` and `Dropdown` are combined, split buttons can be used. The split buttons add the space between the buttons and change the rounded corners of the buttons.
#### Basic Usage
```jsx live=true dir="column"
import React, { useState } from 'react';
import { SplitButtonGroup, Dropdown, Button } from '@douyinfe/semi-ui';
import { IconTreeTriangleDown } from '@douyinfe/semi-icons';
function SplitButtonDemo(){
const menu = [
{ node: 'title', name: 'Title' },
{ node: 'item', name: 'Edit', onClick: () => console.log('Edit clicked') },
{ node: 'item', name: 'Reset', type: 'secondary' },
{ node: 'divider' },
{ node: 'item', name: 'Create', type: 'tertiary' },
{ node: 'item', name: 'Copy', type: 'warning' },
{ node: 'divider' },
{ node: 'item', name: 'Delete', type: 'danger' },
];
const [btnVisible,setBtnVisible] = useState({
1:false,
2:false,
3:false
});
const handleVisibleChange = (key,visible)=>{
newBtnVisible = {...btnVisible};
newBtnVisible[key] = visible;
setBtnVisible(newBtnVisible);
};
return (