JGuang / JGuang UI
Components组件Radix UIRadix UI 组件

切换按钮

在按下与未按下状态之间切换。

中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…

安装

Command

Manual

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

安装以下依赖:

npm install radix-ui

将以下代码复制到你的项目中。

View complete source: components/ui/toggle.tsx

根据项目配置更新导入路径。

用法

import { Toggle } from "@/components/ui/toggle"
<Toggle>Toggle</Toggle>

描边

Use variant="outline" for an outline style.

Loading JGuang UI example…

With Text

Loading JGuang UI example…

尺寸

Use the size prop to change the size of the toggle.

Loading JGuang UI example…

Disabled

Loading JGuang UI example…

从右到左布局

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

API 参考

See the Radix Toggle documentation.

来源: components/radix/toggle.mdx

JGuang UI 技术文档。

On this page