Skip to main content

LoadingButton

Function LoadingButton 

Source
pub fn LoadingButton(_: LoadingButtonProps) -> Element
Expand description

主操作按钮,内置 loading spinner 叠加(统一三态)。

用于全站所有主题绿 CTA(执行 / 刷新 / 创建备份 / 发布 / 保存设置)。 三态:

  • loading=true:主题绿底 + 文字隐藏(opacity-0)+ spinner 绝对居中 (按钮宽度不变,避免加载时布局抖动)
  • disabled=true(且未 loading):灰色底(bg-paper-tertiary)+ cursor-not-allowed
  • 正常:主题绿底 + hover:brightness-110 + active:scale-[0.98]

Props:

  • label:正常态显示的文案(loading 时隐藏,由 spinner 占位)
  • loading:是否处于加载态
  • disabled:是否禁用(loading 优先级更高)
  • variant"primary"(默认,px-5 py-2)或 "sm"px-4 py-1.5
  • onclick:点击回调

§Props

For details, see the props struct definition.