Skip to content

Commit

Permalink
docs: component slider (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerzon05 authored Oct 12, 2024
1 parent 99ee1bf commit 103d016
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
104 changes: 103 additions & 1 deletion docs/content/docs/components/slider.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,106 @@
---
title: Slider
description: A slider is a form control that lets users select a value from a range of values.
---
---

## Import

- **Slider**: The main component to display a slider.

## Usage

<Slider defaultValue={[50]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider defaultValue={[50]} max={100} step={1} />
)
}
```

## Examples

### Default

<Slider variant="default" defaultValue={[22]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider variant="default" defaultValue={[22]} max={100} step={1} />
)
}
```

### Primary

<Slider variant="primary" defaultValue={[80]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider variant="primary" defaultValue={[80]} max={100} step={1} />
)
}
```

### Success

<Slider variant="success" defaultValue={[100]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider variant="success" defaultValue={[100]} max={100} step={1} />
)
}
```

### Warn

<Slider variant="warn" defaultValue={[56]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider variant="warn" defaultValue={[56]} max={100} step={1} />
)
}
```

### Error

<Slider variant="error" defaultValue={[10]} max={100} step={1} />

```jsx
import { Slider } from "@openlite/ui"

export function SliderDemo() {
return (
<Slider variant="error" defaultValue={[10]} max={100} step={1} />
)
}
```

## API

### Slider Props

| Props | Type | Description |
| ----- | ---- | ----------- |
| defaultValue | number[] | The default value of the slider. |
| max | number | The maximum value of the slider. |
| min | number | The minimum value of the slider. |
| step | number | The granularity the slider can step through values. |
| variant | `'default' \| 'primary' \| 'success' \| 'warn' \| 'error'` | The variant of the slider. |
2 changes: 2 additions & 0 deletions docs/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
SelectTrigger,
SelectValue,
Separator,
Slider,
Tooltip,
TooltipContent,
TooltipProvider,
Expand Down Expand Up @@ -173,6 +174,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents {
TypeTable,
Accordion,
Accordions,
Slider,
InstallTabs: ({
items,
children,
Expand Down

0 comments on commit 103d016

Please sign in to comment.