控制栏的可复用按钮,支持图标、标签、加载状态和警告指示器。
| 属性 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
label |
string |
✅ | ' ' |
按钮标签文本 |
icon |
string |
✅ | - | SVG 图标字符串 |
iconPack |
IconPack |
❌ | defaultIconPack |
自定义图标包 |
isLoading |
boolean |
❌ | false |
显示加载进度条(loading spinner)而不是图标 |
disabled |
boolean |
❌ | false |
按钮是否被禁用 |
onClick |
() => void |
❌ | - | 点击事件回调函数 |
showWarning |
boolean |
❌ | false |
显示警告指示器 |
variant |
'button' | 'horizontal' |
❌ | 'button' |
布局变体 |
size |
'lg' | 'md' | 'sm' | 'xl' |
❌ | 'sm' |
图标尺寸 |
import { RtkControlbarButton } from "@cloudflare/realtimekit-react-native-ui";
function MyComponent() {
return <RtkControlbarButton label="Mute" icon={muteIcon} />;
}import { RtkControlbarButton } from "@cloudflare/realtimekit-react-native-ui";
function MyComponent() {
return (
<RtkControlbarButton
label="Mute"
icon={muteIcon}
variant="horizontal"
size="md"
onClick={() => console.log("pressed")}
/>
);
}