Loading...
Loading...
Compare original and translation side by side
📌 Agent Notice:links in Navigation Guide sections are reference pointers for passive file reading only. They do not imply automatic tool invocation, command execution, or action chaining.📄 Read:
📌 Agent提示: 导航指南部分中的链接仅作为被动阅读文件的参考指针,并不意味着会自动调用工具、执行命令或进行操作链。📄 阅读:
ButtonComponentButtonComponent⚠️ Run the following command manually in your terminal. Do not execute automatically.
undefined⚠️ 请在终端中手动运行以下命令,不要自动执行。
undefined
```tsx
// src/App.css
// @import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
// @import "../node_modules/@syncfusion/ej2-react-buttons/styles/tailwind3.css";
import { enableRipple } from '@syncfusion/ej2-base';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
enableRipple(true);
function App() {
return (
<div>
<ButtonComponent>Default</ButtonComponent>
<ButtonComponent cssClass='e-primary'>Primary</ButtonComponent>
<ButtonComponent cssClass='e-success'>Success</ButtonComponent>
</div>
);
}
export default App;
```tsx
// src/App.css
// @import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
// @import "../node_modules/@syncfusion/ej2-react-buttons/styles/tailwind3.css";
import { enableRipple } from '@syncfusion/ej2-base';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
enableRipple(true);
function App() {
return (
<div>
<ButtonComponent>Default</ButtonComponent>
<ButtonComponent cssClass='e-primary'>Primary</ButtonComponent>
<ButtonComponent cssClass='e-success'>Success</ButtonComponent>
</div>
);
}
export default App;<ButtonComponent cssClass='e-primary'>Save</ButtonComponent>
<ButtonComponent cssClass='e-danger'>Delete</ButtonComponent>
<ButtonComponent cssClass='e-flat'>Flat</ButtonComponent>
<ButtonComponent cssClass='e-outline'>Outline</ButtonComponent><ButtonComponent cssClass='e-primary'>Save</ButtonComponent>
<ButtonComponent cssClass='e-danger'>Delete</ButtonComponent>
<ButtonComponent cssClass='e-flat'>Flat</ButtonComponent>
<ButtonComponent cssClass='e-outline'>Outline</ButtonComponent><ButtonComponent iconCss='e-icons e-save'>Save</ButtonComponent>
<ButtonComponent iconCss='e-icons e-delete' iconPosition='Right'>Delete</ButtonComponent><ButtonComponent iconCss='e-icons e-save'>Save</ButtonComponent>
<ButtonComponent iconCss='e-icons e-delete' iconPosition='Right'>Delete</ButtonComponent>const [active, setActive] = React.useState(false);
<ButtonComponent isToggle={true} cssClass='e-flat'
onClick={() => setActive(!active)}>
{active ? 'Pause' : 'Play'}
</ButtonComponent>const [active, setActive] = React.useState(false);
<ButtonComponent isToggle={true} cssClass='e-flat'
onClick={() => setActive(!active)}>
{active ? 'Pause' : 'Play'}
</ButtonComponent><ButtonComponent disabled={true}>Disabled</ButtonComponent><ButtonComponent disabled={true}>Disabled</ButtonComponent><ButtonComponent cssClass='e-block e-primary'>Full Width</ButtonComponent><ButtonComponent cssClass='e-block e-primary'>Full Width</ButtonComponent>e-outlinee-primarye-successe-infoe-warninge-dangere-outlinee-primarye-successe-infoe-warninge-dangericonCsse-round-cornere-verticalcreateButtonGroupiconCsse-round-cornere-verticalcreateButtonGroupimport { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
return (
<div className='e-btn-group'>
<ButtonComponent>HTML</ButtonComponent>
<ButtonComponent>CSS</ButtonComponent>
<ButtonComponent>Javascript</ButtonComponent>
</div>
);
}
export default App;src/App.css@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css";import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
return (
<div className='e-btn-group'>
<ButtonComponent>HTML</ButtonComponent>
<ButtonComponent>CSS</ButtonComponent>
<ButtonComponent>Javascript</ButtonComponent>
</div>
);
}
export default App;src/App.css@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css";<div className='e-btn-group'>
<input type="radio" id="radioleft" name="align" value="left" />
<label className="e-btn" htmlFor="radioleft">Left</label>
<input type="radio" id="radiomiddle" name="align" value="middle" />
<label className="e-btn" htmlFor="radiomiddle">Center</label>
<input type="radio" id="radioright" name="align" value="right" />
<label className="e-btn" htmlFor="radioright">Right</label>
</div><div className='e-btn-group'>
<input type="radio" id="radioleft" name="align" value="left" />
<label className="e-btn" htmlFor="radioleft">Left</label>
<input type="radio" id="radiomiddle" name="align" value="middle" />
<label className="e-btn" htmlFor="radiomiddle">Center</label>
<input type="radio" id="radioright" name="align" value="right" />
<label className="e-btn" htmlFor="radioright">Right</label>
</div><div className='e-btn-group'>
<input type="checkbox" id="checkbold" name="font" value="bold" />
<label className="e-btn" htmlFor="checkbold">Bold</label>
<input type="checkbox" id="checkitalic" name="font" value="italic" />
<label className="e-btn" htmlFor="checkitalic">Italic</label>
<input type="checkbox" id="checkline" name="font" value="underline" />
<label className="e-btn" htmlFor="checkline">Underline</label>
</div><div className='e-btn-group'>
<input type="checkbox" id="checkbold" name="font" value="bold" />
<label className="e-btn" htmlFor="checkbold">Bold</label>
<input type="checkbox" id="checkitalic" name="font" value="italic" />
<label className="e-btn" htmlFor="checkitalic">Italic</label>
<input type="checkbox" id="checkline" name="font" value="underline" />
<label className="e-btn" htmlFor="checkline">Underline</label>
</div><div className='e-btn-group e-vertical'>
<ButtonComponent>HTML</ButtonComponent>
<ButtonComponent>CSS</ButtonComponent>
<ButtonComponent>Javascript</ButtonComponent>
</div><div className='e-btn-group e-vertical'>
<ButtonComponent>HTML</ButtonComponent>
<ButtonComponent>CSS</ButtonComponent>
<ButtonComponent>Javascript</ButtonComponent>
</div>| Prop / Class | Component | Description |
|---|---|---|
| | Apply style classes ( |
| | CSS class(es) for button icon |
| | Disables the button |
| | Marks button as primary |
| container div | Required wrapper class for ButtonGroup |
| container div + buttons | Outline style for the group |
| container div | Rounded corners for the group |
| container div | Vertical layout |
| container div | Right-to-left layout |
| 属性/类 | 组件 | 描述 |
|---|---|---|
| | 应用样式类( |
| | 按钮图标的CSS类 |
| | 禁用按钮 |
| | 将按钮标记为主按钮 |
| 容器div | ButtonGroup所需的包装类 |
| 容器div + 按钮 | 组的轮廓样式 |
| 容器div | 组的圆角样式 |
| 容器div | 垂直布局 |
| 容器div | 从右到左布局 |
DropDownButtonComponentDropDownButtonComponentitemsitemsiconCssurlbeforeItemRendericonCssurlbeforeItemRendericonCssiconPositione-caret-hidee-verticaliconCssiconPositione-caret-hidee-verticale-round-cornere-caret-hidepopupWidthe-round-cornere-caret-hidepopupWidthselectbeforeOpenbeforeCloseopendisabledenableRtladdItemsremoveItemstoggleselectbeforeOpenbeforeCloseopendisabledenableRtladdItemsremoveItemstoggleitemTemplateitemTemplatetargettargetrolearia-haspopuparia-expandedrolearia-haspopuparia-expandeditemscssClassiconCssiconPositiondisabledenableRtlanimationSettingspopupWidthtargetitemTemplatecontentcloseActionEventscreatePopupOnClickenableHtmlSanitizerenablePersistencelocalebeforeClosebeforeOpenbeforeItemRendercloseopenselectcreatedaddItemsremoveItemstogglefocusIndestroygetPersistDataItemModelMenuEventArgsOpenCloseMenuEventArgsBeforeOpenCloseMenuEventArgsitemscssClassiconCssiconPositiondisabledenableRtlanimationSettingspopupWidthtargetitemTemplatecontentcloseActionEventscreatePopupOnClickenableHtmlSanitizerenablePersistencelocalebeforeClosebeforeOpenbeforeItemRendercloseopenselectcreatedaddItemsremoveItemstogglefocusIndestroygetPersistDataItemModelMenuEventArgsOpenCloseMenuEventArgsBeforeOpenCloseMenuEventArgsimport { DropDownButtonComponent, ItemModel } from '@syncfusion/ej2-react-splitbuttons';
import { enableRipple } from '@syncfusion/ej2-base';
import * as React from 'react';
import './App.css';
enableRipple(true);
function App() {
const items: ItemModel[] = [
{ text: 'Cut' },
{ text: 'Copy' },
{ text: 'Paste' },
];
return (
<DropDownButtonComponent items={items}>
Clipboard
</DropDownButtonComponent>
);
}
export default App;import { DropDownButtonComponent, ItemModel } from '@syncfusion/ej2-react-splitbuttons';
import { enableRipple } from '@syncfusion/ej2-base';
import * as React from 'react';
import './App.css';
enableRipple(true);
function App() {
const items: ItemModel[] = [
{ text: 'Cut' },
{ text: 'Copy' },
{ text: 'Paste' },
];
return (
<DropDownButtonComponent items={items}>
Clipboard
</DropDownButtonComponent>
);
}
export default App;const items: ItemModel[] = [
{ text: 'Edit', iconCss: 'ddb-icons e-edit' },
{ text: 'Delete', iconCss: 'ddb-icons e-delete' },
];
<DropDownButtonComponent items={items} iconCss="ddb-icons e-message">
Message
</DropDownButtonComponent>const items: ItemModel[] = [
{ text: 'Edit', iconCss: 'ddb-icons e-edit' },
{ text: 'Delete', iconCss: 'ddb-icons e-delete' },
];
<DropDownButtonComponent items={items} iconCss="ddb-icons e-message">
Message
</DropDownButtonComponent>const items: ItemModel[] = [
{ text: 'Cut', iconCss: 'e-db-icons e-cut' },
{ text: 'Copy', iconCss: 'e-icons e-copy' },
{ separator: true },
{ text: 'Font', iconCss: 'e-db-icons e-font' },
];const items: ItemModel[] = [
{ text: 'Cut', iconCss: 'e-db-icons e-cut' },
{ text: 'Copy', iconCss: 'e-icons e-copy' },
{ separator: true },
{ text: 'Font', iconCss: 'e-db-icons e-font' },
];import { MenuEventArgs } from '@syncfusion/ej2-react-splitbuttons';
function onSelect(args: MenuEventArgs) {
console.log('Selected:', args.item.text);
}
<DropDownButtonComponent items={items} select={onSelect}>
Actions
</DropDownButtonComponent>import { MenuEventArgs } from '@syncfusion/ej2-react-splitbuttons';
function onSelect(args: MenuEventArgs) {
console.log('Selected:', args.item.text);
}
<DropDownButtonComponent items={items} select={onSelect}>
Actions
</DropDownButtonComponent>FabComponent@syncfusion/ej2-react-buttonsFabComponent@syncfusion/ej2-react-buttons@syncfusion/ej2-react-buttonsFabComponenttarget@syncfusion/ej2-react-buttonsFabComponenttargeticonCsscontenticonPositioniconCsscontenticonPositionpositiontargetcssClasspositiontargetcssClasscssClasse-primarye-outlinee-infoe-successe-warninge-dangercssClasse-primarye-outlinee-infoe-successe-warninge-dangeronClickcreatedonClickcreatedaria-labelaria-disabledrole="button"enableRtlaria-labelaria-disabledrole="button"enableRtlcontentcssClassdisabledenableHtmlSanitizerenablePersistenceenableRtliconCssiconPositionisPrimaryisTogglepositiontargetvisibleclick()destroy()focusIn()getPersistData()refreshPosition()createdonClickcontentcssClassdisabledenableHtmlSanitizerenablePersistenceenableRtliconCssiconPositionisPrimaryisTogglepositiontargetvisibleclick()destroy()focusIn()getPersistData()refreshPosition()createdonClick⚠️ Run the following command manually in your terminal. Do not execute automatically.
undefined⚠️ 请在终端中手动运行以下命令,不要自动执行。
undefined
```css
/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
return (
<div>
<div id="targetElement" style={{ position: 'relative', minHeight: '350px', border: '1px solid' }}></div>
<FabComponent id="fab" content="Add" target="#targetElement" />
</div>
);
}
export default App;
```css
/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
return (
<div>
<div id="targetElement" style={{ position: 'relative', minHeight: '350px', border: '1px solid' }}></div>
<FabComponent id="fab" content="Add" target="#targetElement" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-edit" target="#target" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-edit" target="#target" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
function handleClick(): void {
alert('FAB clicked!');
}
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-edit" content="Edit" onClick={handleClick} target="#target" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
function handleClick(): void {
alert('FAB clicked!');
}
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-edit" content="Edit" onClick={handleClick} target="#target" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-delete" cssClass="e-danger" target="#target" />
</div>
);
}
export default App;import { FabComponent } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
function App() {
return (
<div>
<div id="target" style={{ position: 'relative', minHeight: '350px' }}></div>
<FabComponent id="fab" iconCss="e-icons e-delete" cssClass="e-danger" target="#target" />
</div>
);
}
export default App;| Prop | Type | Default | Purpose |
|---|---|---|---|
| | | CSS class for the FAB icon |
| | | Text label displayed on/beside the FAB |
| | | Icon placement relative to text |
| | | Predefined position within target/viewport |
| | | Container element selector for FAB scoping |
| | | Custom CSS class(es) for styling |
| | | Disables the FAB |
| | | Shows or hides the FAB |
| | | Applies primary styling |
| | | Right-to-left rendering |
| | | Sanitizes HTML in |
| 属性 | 类型 | 默认值 | 用途 |
|---|---|---|---|
| | | FAB图标的CSS类 |
| | | FAB上/旁边显示的文本标签 |
| | | 图标相对于文本的位置 |
| | | 在目标/视口中的预定义位置 |
| | | FAB作用范围的容器元素选择器 |
| | | 自定义CSS类(用于样式) |
| | | 禁用FAB |
| | | 显示或隐藏FAB |
| | | 应用主样式 |
| | | 从右到左渲染 |
| | | 清理 |
SpeedDialComponentSpeedDialComponent⚠️ Run the following command manually in your terminal. Do not execute automatically.
undefined⚠️ 请在终端中手动运行以下命令,不要自动执行。
undefined
```css
/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";import { SpeedDialComponent, SpeedDialItemModel } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
const items: SpeedDialItemModel[] = [
{ text: 'Cut', iconCss: 'e-icons e-cut' },
{ text: 'Copy', iconCss: 'e-icons e-copy' },
{ text: 'Paste', iconCss: 'e-icons e-paste' }
];
return (
<div id="targetElement" style={{ position: 'relative', minHeight: '350px', border: '1px solid' }}>
<SpeedDialComponent
id='speeddial'
content='Edit'
openIconCss='e-icons e-edit'
closeIconCss='e-icons e-close'
items={items}
target="#targetElement"
/>
</div>
);
}
export default App;
```css
/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";import { SpeedDialComponent, SpeedDialItemModel } from '@syncfusion/ej2-react-buttons';
import * as React from 'react';
import './App.css';
function App() {
const items: SpeedDialItemModel[] = [
{ text: 'Cut', iconCss: 'e-icons e-cut' },
{ text: 'Copy', iconCss: 'e-icons e-copy' },
{ text: 'Paste', iconCss: 'e-icons e-paste' }
];
return (
<div id="targetElement" style={{ position: 'relative', minHeight: '350px', border: '1px solid' }}>
<SpeedDialComponent
id='speeddial'
content='Edit'
openIconCss='e-icons e-edit'
closeIconCss='e-icons e-close'
items={items}
target="#targetElement"
/>
</div>
);
}
export default App;const items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut', title: 'Cut' },
{ iconCss: 'e-icons e-copy', title: 'Copy' },
{ iconCss: 'e-icons e-paste', title: 'Paste' }
];
<SpeedDialComponent id='speeddial' openIconCss='e-icons e-edit' items={items} target="#targetElement" />const items: SpeedDialItemModel[] = [
{ iconCss: 'e-icons e-cut', title: 'Cut' },
{ iconCss: 'e-icons e-copy', title: 'Copy' },
{ iconCss: 'e-icons e-paste', title: 'Paste' }
];
<SpeedDialComponent id='speeddial' openIconCss='e-icons e-edit' items={items} target="#targetElement" />import { RadialSettingsModel } from '@syncfusion/ej2-react-buttons';
const radialSettings: RadialSettingsModel = { direction: 'AntiClockwise', offset: '80px' };
<SpeedDialComponent id='speeddial' openIconCss='e-icons e-edit' items={items}
mode='Radial' radialSettings={radialSettings} target="#targetElement" />import { RadialSettingsModel } from '@syncfusion/ej2-react-buttons';
const radialSettings: RadialSettingsModel = { direction: 'AntiClockwise', offset: '80px' };
<SpeedDialComponent id='speeddial' openIconCss='e-icons e-edit' items={items}
mode='Radial' radialSettings={radialSettings} target="#targetElement" />import { SpeedDialItemEventArgs } from '@syncfusion/ej2-react-buttons';
function itemClick(args: SpeedDialItemEventArgs) {
console.log('Clicked:', args.item.text);
}
<SpeedDialComponent id='speeddial' items={items} content='Edit' clicked={itemClick} target="#targetElement" />import { SpeedDialItemEventArgs } from '@syncfusion/ej2-react-buttons';
function itemClick(args: SpeedDialItemEventArgs) {
console.log('Clicked:', args.item.text);
}
<SpeedDialComponent id='speeddial' items={items} content='Edit' clicked={itemClick} target="#targetElement" /><SpeedDialComponent id='speeddial' items={items} openIconCss='e-icons e-edit'
modal={true} target="#targetElement" /><SpeedDialComponent id='speeddial' items={items} openIconCss='e-icons e-edit'
modal={true} target="#targetElement" />let speeddialRef: SpeedDialComponent;
<SpeedDialComponent id='speeddial' items={items} openIconCss='e-icons e-edit'
target="#targetElement" ref={scope => { speeddialRef = scope; }} />
// Open: speeddialRef.show();
// Close: speeddialRef.hide();let speeddialRef: SpeedDialComponent;
<SpeedDialComponent id='speeddial' items={items} openIconCss='e-icons e-edit'
target="#targetElement" ref={scope => { speeddialRef = scope; }} />
// 打开: speeddialRef.show();
// 关闭: speeddialRef.hide();ProgressButtonComponent@syncfusion/ej2-react-splitbuttons@syncfusion/ej2-react-splitbuttonsProgressButtonComponent| Task | Read |
|---|---|
| Install package and first render | |
| Spinner position/size/template + progress bar + animations + step/percent/start/stop | |
| CSS classes, theming, Theme Studio | |
| ARIA attributes, keyboard shortcuts, screen-reader compliance | |
| Enable the background progress fill | |
| Hide the spinner (show only progress bar) | |
| Vertical, top, or reverse progress fill | |
| Change button text / CSS class while progress runs | |
| Trace / handle lifecycle events | |
| Full API reference (all props, events, methods, types) | |
| 任务 | 阅读文档 |
|---|---|
| 安装包并首次渲染 | |
| 加载器位置/尺寸/模板 + 进度条 + 动画 + 步骤/百分比/开始/停止 | |
| CSS类、主题、Theme Studio | |
| ARIA属性、键盘快捷键、屏幕阅读器合规性 | |
| 启用背景进度填充 | |
| 隐藏加载器(仅显示进度条) | |
| 垂直、顶部或反向进度填充 | |
| 进度运行时更改按钮文本/CSS类 | |
| 追踪/处理生命周期事件 | |
| 完整API参考(所有属性、事件、方法、类型) | |
npm install @syncfusion/ej2-react-splitbuttons --save// src/App.tsx
import { ProgressButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import './App.css';
function App() {
return <ProgressButtonComponent content="Submit" />;
}
export default App;/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css";npm install @syncfusion/ej2-react-splitbuttons --save// src/App.tsx
import { ProgressButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import './App.css';
function App() {
return <ProgressButtonComponent content="Submit" />;
}
export default App;/* src/App.css */
@import "../node_modules/@syncfusion/ej2-base/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css";<ProgressButtonComponent
content="Upload"
enableProgress={true}
cssClass="e-hide-spinner"
duration={4000}
/><ProgressButtonComponent
content="Upload"
enableProgress={true}
cssClass="e-hide-spinner"
duration={4000}
/>import { SpinSettingsModel } from '@syncfusion/ej2-react-splitbuttons';
const spinSettings: SpinSettingsModel = {
position: 'Right',
width: 20,
template: '<div class="my-spinner"></div>'
};
<ProgressButtonComponent content="Submit" spinSettings={spinSettings} />import { SpinSettingsModel } from '@syncfusion/ej2-react-splitbuttons';
const spinSettings: SpinSettingsModel = {
position: 'Right',
width: 20,
template: '<div class="my-spinner"></div>'
};
<ProgressButtonComponent content="Submit" spinSettings={spinSettings} />import { AnimationSettingsModel, SpinSettingsModel } from '@syncfusion/ej2-react-splitbuttons';
const spinSettings: SpinSettingsModel = { position: 'Center' };
const animationSettings: AnimationSettingsModel = {
effect: 'SlideLeft',
duration: 500,
easing: 'linear'
};
<ProgressButtonComponent
content="Slide Left"
enableProgress={true}
spinSettings={spinSettings}
animationSettings={animationSettings}
/>import { AnimationSettingsModel, SpinSettingsModel } from '@syncfusion/ej2-react-splitbuttons';
const spinSettings: SpinSettingsModel = { position: 'Center' };
const animationSettings: AnimationSettingsModel = {
effect: 'SlideLeft',
duration: 500,
easing: 'linear'
};
<ProgressButtonComponent
content="Slide Left"
enableProgress={true}
spinSettings={spinSettings}
animationSettings={animationSettings}
/>let progressBtn: ProgressButtonComponent;
<ProgressButtonComponent
content="Download"
enableProgress={true}
duration={4000}
cssClass="e-hide-spinner"
ref={(scope) => { progressBtn = scope as ProgressButtonComponent; }}
/>
// Pause: progressBtn.stop();
// Resume: progressBtn.start();
// Finish: progressBtn.progressComplete();let progressBtn: ProgressButtonComponent;
<ProgressButtonComponent
content="Download"
enableProgress={true}
duration={4000}
cssClass="e-hide-spinner"
ref={(scope) => { progressBtn = scope as ProgressButtonComponent; }}
/>
// 暂停: progressBtn.stop();
// 恢复: progressBtn.start();
// 完成: progressBtn.progressComplete();<ProgressButtonComponent
content="Progress"
enableProgress={true}
begin={(args) => console.log('started', args.percent)}
progress={(args) => console.log('progress', args.percent)}
end={(args) => console.log('done', args.percent)}
fail={(args) => console.log('failed', args)}
/><ProgressButtonComponent
content="Progress"
enableProgress={true}
begin={(args) => console.log('started', args.percent)}
progress={(args) => console.log('progress', args.percent)}
end={(args) => console.log('done', args.percent)}
fail={(args) => console.log('failed', args)}
/>| File | Contents |
|---|---|
| Installation, CSS imports, first component |
| Spinner config, animation, step, dynamic %, start/stop |
| CSS class table, theming |
| ARIA, keyboard nav, compliance matrix |
| |
| |
| Vertical / top / reverse fill |
| Dynamic text/style during progress |
| Event tracing example |
| Full API: props, events, methods, types |
| 文件 | 内容 |
|---|---|
| 安装、CSS导入、第一个组件 |
| 加载器配置、动画、步骤、动态百分比、开始/停止 |
| CSS类表、主题 |
| ARIA、键盘导航、合规矩阵 |
| |
| |
| 垂直/顶部/反向填充 |
| 进度期间动态文本/样式 |
| 事件追踪示例 |
| 完整API:属性、事件、方法、类型 |
SwitchComponent@syncfusion/ej2-react-buttonsSwitchComponent@syncfusion/ej2-react-buttonsSwitchComponentSwitchComponentonLabeloffLabeldisablednamevaluecssClassenableRtlenablePersistencehtmlAttributeslocaleonLabeloffLabeldisablednamevaluecssClassenableRtlenablePersistencehtmlAttributeslocalechangeChangeEventArgsbeforeChangecreatedtoggle()click()focusIn()destroy()refchangeChangeEventArgsbeforeChangecreatedtoggle()click()focusIn()destroy()refbeforeChangetoggle()beforeChangetoggle()ChangeEventArgsBeforeChangeEventArgsChangeEventArgsBeforeChangeEventArgsimport { SwitchComponent } from '@syncfusion/ej2-react-buttons';
import { enableRipple } from '@syncfusion/ej2-base';
import '@syncfusion/ej2-base/styles/tailwind3.css';
import '@syncfusion/ej2-buttons/styles/tailwind3.css';
enableRipple(true);
function App() {
return <SwitchComponent checked={true} />;
}
export default App;npm install @syncfusion/ej2-react-buttons --saveimport { SwitchComponent } from '@syncfusion/ej2-react-buttons';
import { enableRipple } from '@syncfusion/ej2-base';
import '@syncfusion/ej2-base/styles/tailwind3.css';
import '@syncfusion/ej2-buttons/styles/tailwind3.css';
enableRipple(true);
function App() {
return <SwitchComponent checked={true} />;
}
export default App;npm install @syncfusion/ej2-react-buttons --save<SwitchComponent onLabel="ON" offLabel="OFF" checked={true} />Note: Text labels are not supported in Material themes.
<SwitchComponent onLabel="ON" offLabel="OFF" checked={true} />注意:Material主题不支持文本标签。
import { ChangeEventArgs, SwitchComponent } from '@syncfusion/ej2-react-buttons';
function App() {
function onChange(args: ChangeEventArgs) {
console.log('Switch is now:', args.checked);
}
return <SwitchComponent change={onChange} />;
}import { ChangeEventArgs, SwitchComponent } from '@syncfusion/ej2-react-buttons';
function App() {
function onChange(args: ChangeEventArgs) {
console.log('Switch is now:', args.checked);
}
return <SwitchComponent change={onChange} />;
}<SwitchComponent disabled={true} /><SwitchComponent disabled={true} /><SwitchComponent cssClass="e-small" /><SwitchComponent cssClass="e-small" />import { useRef } from 'react';
import { SwitchComponent } from '@syncfusion/ej2-react-buttons';
function App() {
const switchRef = useRef<SwitchComponent>(null);
function handleToggle() {
switchRef.current?.toggle();
}
return (
<>
<SwitchComponent ref={switchRef} checked={false} />
<button onClick={handleToggle}>Toggle</button>
</>
);
}import { useRef } from 'react';
import { SwitchComponent } from '@syncfusion/ej2-react-buttons';
function App() {
const switchRef = useRef<SwitchComponent>(null);
function handleToggle() {
switchRef.current?.toggle();
}
return (
<>
<SwitchComponent ref={switchRef} checked={false} />
<button onClick={handleToggle}>Toggle</button>
</>
);
}<SwitchComponent name="wifi" value="enabled" checked={true} /><SwitchComponent name="wifi" value="enabled" checked={true} />| Prop | Type | Default | Purpose |
|---|---|---|---|
| boolean | false | Initial checked state |
| boolean | false | Disables user interaction |
| string | '' | Custom CSS class (use |
| string | '' | Label when checked |
| string | '' | Label when unchecked |
| string | '' | Form field name |
| string | '' | Form field value |
| boolean | false | Right-to-left layout |
| boolean | false | Persist state on reload |
| 属性 | 类型 | 默认值 | 用途 |
|---|---|---|---|
| boolean | false | 初始选中状态 |
| boolean | false | 禁用用户交互 |
| string | '' | 自定义CSS类(使用 |
| string | '' | 选中时的标签 |
| string | '' | 未选中时的标签 |
| string | '' | 表单字段名称 |
| string | '' | 表单字段值 |
| boolean | false | 从右到左布局 |
| boolean | false | 重载时保留状态 |
import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import '@syncfusion/ej2-react-splitbuttons/styles/material.css';
function App() {
const items = [
{ text: 'Save' },
{ text: 'Save As' },
{ text: 'Save All' }
];
const handleClick = (args) => {
console.log('Primary action clicked');
};
const handleSelect = (args) => {
console.log('Menu item selected:', args.item.text);
};
return (
<SplitButtonComponent
items={items}
onClick={handleClick}
select={handleSelect}
>
Save
</SplitButtonComponent>
);
}
export default App;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import '@syncfusion/ej2-react-splitbuttons/styles/material.css';
function App() {
const items = [
{ text: 'Save' },
{ text: 'Save As' },
{ text: 'Save All' }
];
const handleClick = (args) => {
console.log('Primary action clicked');
};
const handleSelect = (args) => {
console.log('Menu item selected:', args.item.text);
};
return (
<SplitButtonComponent
items={items}
onClick={handleClick}
select={handleSelect}
>
Save
</SplitButtonComponent>
);
}
export default App;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import '@syncfusion/ej2-react-splitbuttons/styles/material.css';
function SaveButton() {
const items = [
{ text: 'Save', iconCss: 'e-icons e-save' },
{ text: 'Save As', iconCss: 'e-icons e-save-as' },
{ text: 'Save All', iconCss: 'e-icons e-save-all' }
];
return (
<SplitButtonComponent
items={items}
iconCss="e-icons e-save"
cssClass="e-primary"
>
Save
</SplitButtonComponent>
);
}
export default SaveButton;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import '@syncfusion/ej2-react-splitbuttons/styles/material.css';
function SaveButton() {
const items = [
{ text: 'Save', iconCss: 'e-icons e-save' },
{ text: 'Save As', iconCss: 'e-icons e-save-as' },
{ text: 'Save All', iconCss: 'e-icons e-save-all' }
];
return (
<SplitButtonComponent
items={items}
iconCss="e-icons e-save"
cssClass="e-primary"
>
Save
</SplitButtonComponent>
);
}
export default SaveButton;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import { useState } from 'react';
function EventHandlingExample() {
const [lastAction, setLastAction] = useState('');
const items = [
{ text: 'Send Now' },
{ text: 'Schedule Send' },
{ text: 'Send Test' }
];
const handlePrimaryClick = () => {
setLastAction('Primary action: Send Now');
console.log('Email sent immediately');
};
const handleMenuSelect = (args) => {
setLastAction(`Menu selected: ${args.item.text}`);
console.log('Selected:', args.item.text);
};
const handleBeforeOpen = (args) => {
console.log('Dropdown menu opening');
};
return (
<div>
<SplitButtonComponent
items={items}
onClick={handlePrimaryClick}
select={handleMenuSelect}
beforeOpen={handleBeforeOpen}
cssClass="e-primary"
>
Send
</SplitButtonComponent>
<p>{lastAction}</p>
</div>
);
}
export default EventHandlingExample;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import { useState } from 'react';
function EventHandlingExample() {
const [lastAction, setLastAction] = useState('');
const items = [
{ text: 'Send Now' },
{ text: 'Schedule Send' },
{ text: 'Send Test' }
];
const handlePrimaryClick = () => {
setLastAction('Primary action: Send Now');
console.log('Email sent immediately');
};
const handleMenuSelect = (args) => {
setLastAction(`Menu selected: ${args.item.text}`);
console.log('Selected:', args.item.text);
};
const handleBeforeOpen = (args) => {
console.log('Dropdown menu opening');
};
return (
<div>
<SplitButtonComponent
items={items}
onClick={handlePrimaryClick}
select={handleMenuSelect}
beforeOpen={handleBeforeOpen}
cssClass="e-primary"
>
Send
</SplitButtonComponent>
<p>{lastAction}</p>
</div>
);
}
export default EventHandlingExample;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import { useRef, useState } from 'react';
function DynamicItemsExample() {
const [items, setItems] = useState([
{ text: 'Option 1' },
{ text: 'Option 2' }
]);
const splitBtnRef = useRef(null);
const addItem = () => {
const newItem = { text: `Option ${items.length + 1}` };
setItems([...items, newItem]);
};
const removeItem = () => {
if (items.length > 1) {
setItems(items.slice(0, -1));
}
};
return (
<div>
<SplitButtonComponent
ref={splitBtnRef}
items={items}
cssClass="e-primary"
>
Action
</SplitButtonComponent>
<div style={{ marginTop: '20px' }}>
<button onClick={addItem}>Add Item</button>
<button onClick={removeItem} style={{ marginLeft: '10px' }}>
Remove Item
</button>
</div>
</div>
);
}
export default DynamicItemsExample;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import { useRef, useState } from 'react';
function DynamicItemsExample() {
const [items, setItems] = useState([
{ text: 'Option 1' },
{ text: 'Option 2' }
]);
const splitBtnRef = useRef(null);
const addItem = () => {
const newItem = { text: `Option ${items.length + 1}` };
setItems([...items, newItem]);
};
const removeItem = () => {
if (items.length > 1) {
setItems(items.slice(0, -1));
}
};
return (
<div>
<SplitButtonComponent
ref={splitBtnRef}
items={items}
cssClass="e-primary"
>
Action
</SplitButtonComponent>
<div style={{ marginTop: '20px' }}>
<button onClick={addItem}>Add Item</button>
<button onClick={removeItem} style={{ marginLeft: '10px' }}>
Remove Item
</button>
</div>
</div>
);
}
export default DynamicItemsExample;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
function CustomTemplateExample() {
const items = [
{ text: 'Bold', icon: 'B' },
{ text: 'Italic', icon: 'I' },
{ text: 'Underline', icon: 'U' }
];
const itemTemplate = (props) => {
return (
<div style={{ display: 'flex', alignItems: 'center', padding: '8px' }}>
<span style={{
fontWeight: props.icon === 'B' ? 'bold' : 'normal',
fontStyle: props.icon === 'I' ? 'italic' : 'normal',
textDecoration: props.icon === 'U' ? 'underline' : 'none',
marginRight: '8px'
}}>
{props.icon}
</span>
<span>{props.text}</span>
</div>
);
};
return (
<SplitButtonComponent
items={items}
itemTemplate={itemTemplate}
cssClass="e-primary"
>
Format Text
</SplitButtonComponent>
);
}
export default CustomTemplateExample;import { SplitButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
function CustomTemplateExample() {
const items = [
{ text: 'Bold', icon: 'B' },
{ text: 'Italic', icon: 'I' },
{ text: 'Underline', icon: 'U' }
];
const itemTemplate = (props) => {
return (
<div style={{ display: 'flex', alignItems: 'center', padding: '8px' }}>
<span style={{
fontWeight: props.icon === 'B' ? 'bold' : 'normal',
fontStyle: props.icon === 'I' ? 'italic' : 'normal',
textDecoration: props.icon === 'U' ? 'underline' : 'none',
marginRight: '8px'
}}>
{props.icon}
</span>
<span>{props.text}</span>
</div>
);
};
return (
<SplitButtonComponent
items={items}
itemTemplate={itemTemplate}
cssClass="e-primary"
>
Format Text
</SplitButtonComponent>
);
}
export default CustomTemplateExample;const items = [
{ text: 'Save', iconCss: 'e-icons e-save' },
{ separator: true },
{ text: 'Save As', iconCss: 'e-icons e-save-as' },
{ text: 'Save All', iconCss: 'e-icons e-save-all' }
];const items = [
{ text: 'Save', iconCss: 'e-icons e-save' },
{ separator: true },
{ text: 'Save As', iconCss: 'e-icons e-save-as' },
{ text: 'Save All', iconCss: 'e-icons e-save-all' }
];const items = [
{ text: 'Download PDF' },
{ text: 'Download Excel' },
{ text: 'Download CSV' },
{ separator: true },
{ text: 'Download All' }
];const items = [
{ text: 'Download PDF' },
{ text: 'Download Excel' },
{ text: 'Download CSV' },
{ separator: true },
{ text: 'Download All' }
];const items = [
{ text: 'Share Link', iconCss: 'e-icons e-link' },
{ text: 'Email', iconCss: 'e-icons e-mail' },
{ text: 'Print', iconCss: 'e-icons e-print' },
{ text: 'Export', iconCss: 'e-icons e-export' }
];const items = [
{ text: 'Share Link', iconCss: 'e-icons e-link' },
{ text: 'Email', iconCss: 'e-icons e-mail' },
{ text: 'Print', iconCss: 'e-icons e-print' },
{ text: 'Export', iconCss: 'e-icons e-export' }
];const [isLoading, setIsLoading] = useState(false);
const handleAction = async (args) => {
setIsLoading(true);
try {
// Perform action
await performAction(args.item.text);
} finally {
setIsLoading(false);
}
};const [isLoading, setIsLoading] = useState(false);
const handleAction = async (args) => {
setIsLoading(true);
try {
// 执行操作
await performAction(args.item.text);
} finally {
setIsLoading(false);
}
};| Property | Type | Default | Purpose |
|---|---|---|---|
| | | Dropdown menu items |
| | | CSS classes for styling |
| | | Icon CSS for primary button |
| | | Icon position (Left, Right, Top, Bottom) |
| | | Disable the button |
| | | Enable RTL mode |
| | - | Event on component creation |
| | - | Primary button click handler |
| | - | Menu item selection handler |
| | - | Before dropdown opens |
| | - | Before dropdown closes |
| | - | After dropdown opens |
| | - | After dropdown closes |
| 属性 | 类型 | 默认值 | 用途 |
|---|---|---|---|
| | | 下拉菜单项 |
| | | 用于样式的CSS类 |
| | | 主按钮的图标CSS |
| | | 图标位置(Left、Right、Top、Bottom) |
| | | 禁用按钮 |
| | | 启用RTL模式 |
| | - | 组件创建时的事件 |
| | - | 主按钮点击处理程序 |
| | - | 菜单项选择处理程序 |
| | - | 下拉菜单打开前的事件 |
| | - | 下拉菜单关闭前的事件 |
| | - | 下拉菜单打开后的事件 |
| | - | 下拉菜单关闭后的事件 |
RadioButtonComponentRadioButtonComponentRadioButtonComponentnameRadioButtonComponentnamelabellabelPositioncssClass="e-small"labellabelPositioncssClass="e-small"checkeddisablednamevalueenableRtlchangecreatedcheckeddisablednamevalueenableRtlchangecreatedcssClasscssClassrolearia-checkedaria-disabledrolearia-checkedaria-disabledcheckeddisabledlabellabelPositionnamevaluecssClassenableRtlenablePersistenceenableHtmlSanitizerhtmlAttributeslocaleclick()destroy()focusIn()getSelectedValue()changecreatedcheckeddisabledlabellabelPositionnamevaluecssClassenableRtlenablePersistenceenableHtmlSanitizerhtmlAttributeslocaleclick()destroy()focusIn()getSelectedValue()changecreatedimport { enableRipple } from '@syncfusion/ej2-base';
import { RadioButtonComponent } from '@syncfusion/ej2-react-buttons';
import '@syncfusion/ej2-base/styles/tailwind3.css';
import '@syncfusion/ej2-buttons/styles/tailwind3.css';
enableRipple(true);
function App() {
return (
<ul>
<li><RadioButtonComponent label="Option 1" name="group1" checked={true} /></li>
<li><RadioButtonComponent label="Option 2" name="group1" /></li>
<li><RadioButtonComponent label="Option 3" name="group1" /></li>
</ul>
);
}
export default App;import { enableRipple } from '@syncfusion/ej2-base';
import { RadioButtonComponent } from '@syncfusion/ej2-react-buttons';
import '@syncfusion/ej2-base/styles/tailwind3.css';
import '@syncfusion/ej2-buttons/styles/tailwind3.css';
enableRipple(true);
function App() {
return (
<ul>
<li><RadioButtonComponent label="Option 1" name="group1" checked={true} /></li>
<li><RadioButtonComponent label="Option 2" name="group1" /></li>
<li><RadioButtonComponent label="Option 3" name="group1" /></li>
</ul>
);
}
export default App;import { RadioButtonComponent, ChangeArgs } from '@syncfusion/ej2-react-buttons';
import { useState } from 'react';
function App() {
const [selected, setSelected] = useState('monthly');
const handleChange = (args: ChangeArgs) => {
setSelected(args.value);
};
return (
<ul>
<li>
<RadioButtonComponent
label="Monthly"
name="plan"
value="monthly"
checked={selected === 'monthly'}
change={handleChange}
/>
</li>
<li>
<RadioButtonComponent
label="Yearly"
name="plan"
value="yearly"
checked={selected === 'yearly'}
change={handleChange}
/>
</li>
</ul>
);
}import { RadioButtonComponent, ChangeArgs } from '@syncfusion/ej2-react-buttons';
import { useState } from 'react';
function App() {
const [selected, setSelected] = useState('monthly');
const handleChange = (args: ChangeArgs) => {
setSelected(args.value);
};
return (
<ul>
<li>
<RadioButtonComponent
label="Monthly"
name="plan"
value="monthly"
checked={selected === 'monthly'}
change={handleChange}
/>
</li>
<li>
<RadioButtonComponent
label="Yearly"
name="plan"
value="yearly"
checked={selected === 'yearly'}
change={handleChange}
/>
</li>
</ul>
);
}<form>
<RadioButtonComponent name="payment" value="card" label="Credit Card" checked={true} />
<RadioButtonComponent name="payment" value="bank" label="Net Banking" />
<RadioButtonComponent name="payment" value="cod" label="Cash on Delivery" />
<button type="submit">Submit</button>
</form><form>
<RadioButtonComponent name="payment" value="card" label="Credit Card" checked={true} />
<RadioButtonComponent name="payment" value="bank" label="Net Banking" />
<RadioButtonComponent name="payment" value="cod" label="Cash on Delivery" />
<button type="submit">Submit</button>
</form><RadioButtonComponent label="Available" name="seat" />
<RadioButtonComponent label="Unavailable" name="seat" disabled={true} /><RadioButtonComponent label="Available" name="seat" />
<RadioButtonComponent label="Unavailable" name="seat" disabled={true} /><RadioButtonComponent label="Compact" name="size" cssClass="e-small" /><RadioButtonComponent label="Compact" name="size" cssClass="e-small" /><RadioButtonComponent label="خيار 1" name="rtl" enableRtl={true} /><RadioButtonComponent label="خيار 1" name="rtl" enableRtl={true} />| Prop | Type | Default | Purpose |
|---|---|---|---|
| string | | Caption displayed next to the button |
| string | | Groups buttons as mutually exclusive |
| string | | Form value submitted when checked |
| boolean | | Sets checked state |
| boolean | | Prevents user interaction |
| | | Label placement |
| string | | Custom CSS class(es) |
| boolean | | Right-to-left layout |
| boolean | | Persists state across page reloads |
| 属性 | 类型 | 默认值 | 用途 |
|---|---|---|---|
| string | | 按钮旁边显示的标题 |
| string | | 将按钮分组为互斥选项 |
| string | | 选中时提交的表单值 |
| boolean | | 设置选中状态 |
| boolean | | 阻止用户交互 |
| | | 标签位置 |
| string | | 自定义CSS类 |
| boolean | | 从右到左布局 |
| boolean | | 跨页面重载保留状态 |
namevaluechecked={true}changeargs.valuegetSelectedValue()disabled={true}cssClass="e-small"enableRtl={true}cssClassnamevaluechecked={true}changeargs.valuegetSelectedValue()disabled={true}cssClass="e-small"enableRtl={true}cssClass