触发操作或事件,例如提交表单或显示对话框。
¥API Reference
此组件基于 button
元素并支持 常用边距属性。
¥This component is based on the button
element and supports common margin props.
¥Examples
¥Size
使用 size
属性控制按钮的大小。
¥Use the size
prop to control the size of the button.
¥Variant
使用 variant
属性控制按钮的视觉样式。
¥Use the variant
prop to control the visual style of the button.
¥Ghost
使用 ghost
变体显示不带镶边的按钮。幽灵按钮在布局中的行为类似于文本,因为它们使用负边距使其与兄弟按钮在视觉上对齐,同时在活动和悬停状态下保持填充。
¥Use the ghost
variant to display a button without chrome. Ghost buttons behave like text in layout, as they use a negative margin to optically align themselves against their siblings while maintaining the padding in active and hover states.
¥Color
使用 color
属性指定特定的 color。
¥Use the color
prop to assign a specific color.
¥High-contrast
使用 highContrast
属性增加与背景的颜色对比度。
¥Use the highContrast
prop to increase color contrast with the background.
¥Radius
使用 radius
属性指定特定的圆角值。
¥Use the radius
prop to assign a specific radius value.
¥With icons
你可以将图标直接嵌套在按钮内。会自动提供适当的间隙。
¥You can nest icons directly inside the button. An appropriate gap is provided automatically.
¥Loading
使用 loading
属性显示加载旋转图标来代替按钮内容,并在正常状态下保持按钮的原始大小。该按钮在加载时将被禁用。
¥Use the loading
prop to display a loading spinner in place of button content, preserving the original size of the button in its normal state. The button will be disabled while loading.
如果按钮内有一个图标,你可以使用按钮的 disabled
状态,并将图标封装在独立的 旋转器 中,以实现更复杂的设计。
¥If you have an icon inside the button, you can use the button’s disabled
state and wrap the icon in a standalone Spinner to achieve a more sophisticated design.