# Toggle · JGuang UI

> A two-state button that can be either on or off.

- Page: https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle
- Based on: shadcn/ui documentation (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c

> Example `toggle-demo`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## Installation


  

**Command**


  

**Manual**


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


### Install the following dependencies:


```bash
npm install @base-ui/react
```


### Copy and paste the following code into your project.


[View complete source: components/ui/toggle.tsx](/r/jguang-ui/base/toggle.json)


### Update the import paths to match your project setup.


## Usage

```tsx
import { Toggle } from "@/components/ui/toggle"
```

```tsx
<Toggle>Toggle</Toggle>
```

## Outline

Use `variant="outline"` for an outline style.


> Example `toggle-outline`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## With Text


> Example `toggle-text`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## Size

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


> Example `toggle-sizes`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## Disabled


> Example `toggle-disabled`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> Example `toggle-rtl`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/toggle


## API Reference

See the [Base UI Toggle](https://base-ui.com/react/components/toggle#api-reference) documentation.

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
