# 滑块 · JGuang UI

> 在连续或离散范围内选择一个数值。

- 页面: https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider
- 改编自: shadcn/ui 文档 (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c
- 说明：正文保留英文原文。

> 示例 `slider-demo`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## Installation


  

**Command**


  

**Manual**


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


### Install the following dependencies:


```bash
npm install radix-ui
```


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


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


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


## Usage

```tsx
import { Slider } from "@/components/ui/slider"
```

```tsx
<Slider defaultValue={[33]} max={100} step={1} />
```

## Range

Use an array with two values for a range slider.


> 示例 `slider-range`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## Multiple Thumbs

Use an array with multiple values for multiple thumbs.


> 示例 `slider-multiple`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## Vertical

Use `orientation="vertical"` for a vertical slider.


> 示例 `slider-vertical`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## Controlled


> 示例 `slider-controlled`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## Disabled

Use the `disabled` prop to disable the slider.


> 示例 `slider-disabled`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## RTL

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


> 示例 `slider-rtl`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/slider


## API Reference

See the [Radix UI Slider](https://www.radix-ui.com/docs/primitives/components/slider#api-reference) documentation.

---

JGuang 全部资源索引: https://jiguang132.com/llms.txt
