iOS Round Toggle Button
控制中心风格圆形开关按钮:图标 + 标题,按下后切换为主题色,带 aria-pressed。
复制一段给 AI 编程工具的提示词,包含源码、依赖和用法
属性
IOSRoundToggleButtonProps
同时支持以下类型的全部属性: Omit<React.ComponentProps<"button">, "onChange" | "children" | "defaultValue">
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| icon* 必填 | React.ReactNode | — | — |
| label* 必填 | string | — | Caption under the circle; also used as the accessible name |
| tint | string | "#007aff" | Color of the "on" state |
| pressed | boolean | — | — |
| defaultPressed | boolean | false | — |
| onPressedChange | (pressed: boolean) => void | — | — |
安装
$ npx shadcn@latest add https://chromotion.dev/r/ios-round-toggle-button.json