Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions docs/framework/react/api/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ menu: API
---

## Examples

Want to skip to the implementation? Check out these examples:

- [basic](../../examples/react/basic)
- [basic](https://tanstack.com/ranger/latest/docs/framework/react/examples/basic)

The API below described how to use the **basic** features.

Expand All @@ -18,51 +19,67 @@ The API below described how to use the **basic** features.
```tsx
values: ReadonlyArray<number>
```

**Required** The current value (or values) for the range.

### min

```tsx
min: number
```

**Required** The minimum limit for the range.

### max

```tsx
max: number
```

**Required** The maximum limit for the range.

### stepSize

```ts
stepSize: number
```

**Required** The distance between selectable steps.

### onChange

```ts
onChange: (instance: Ranger<TTrackElement>) => void
```

A function that is called when the handle is released.

## API

### handles

```tsx
handles: ReadonlyArray<{value: number; isActive: boolean; onKeyDownHandler(event): function; onMouseDownHandler(event): function; onTouchStart(event): function}>
handles: ReadonlyArray<{
value: number
isActive: boolean
onKeyDownHandler(event): function
onMouseDownHandler(event): function
onTouchStart(event): function
}>
```

Handles to be rendered. Each `handle` has the following props:
- `value: number` - The current value for the handle.
- `isActive: boolean` - Denotes if the handle is currently being dragged.
- `onKeyDownHandler(event): func`
- `onMouseDownHandler(event): func`
- `onTouchStart(event): func`

- `value: number` - The current value for the handle.
- `isActive: boolean` - Denotes if the handle is currently being dragged.
- `onKeyDownHandler(event): func`
- `onMouseDownHandler(event): func`
- `onTouchStart(event): func`

### activeHandleIndex

```tsx
activeHandleIndex: null | number
```

The zero-based index of the handle that is currently being dragged, or `null` if no handle is being dragged.
17 changes: 12 additions & 5 deletions docs/framework/react/api/custom-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ menu: API
---

## Examples

Want to skip to the implementation? Check out these examples:

- [custom-steps](../examples/custom-steps)
- [custom-steps](https://tanstack.com/ranger/latest/docs/framework/react/examples/custom-steps)

The API below described how to use the **custom-steps** features.

Expand All @@ -18,22 +19,28 @@ The API below described how to use the **custom-steps** features.
```ts
steps: Array<number>
```

An array of custom steps to use. This will override `stepSize`

### ticks

```ts
ticks: Array<number>
```

An array of custom ticks to use. This will override `tickSize`

## API

### getTicks

```tsx
getTicks: () => ReadonlyArray<{value: number; key: number; percentage: number}>
getTicks: () =>
ReadonlyArray<{ value: number; key: number; percentage: number }>
```

Ticks to be rendered. Each `tick` has the following props:
- `value: number` - The tick number to be displayed
- `key: number` - The key of a tick
- `percentage: number` - Percentage value of where tick should be placed on ranger

- `value: number` - The tick number to be displayed
- `key: number` - The key of a tick
- `percentage: number` - Percentage value of where tick should be placed on ranger
12 changes: 8 additions & 4 deletions docs/framework/react/api/custom-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ menu: API
---

## Examples

Want to skip to the implementation? Check out these examples:

- [custom-styles](../examples/custom-styles)
- [custom-styles](https://tanstack.com/ranger/latest/docs/framework/react/examples/custom-styles)

The API below described how to use the **custom-steps** features.

## API

### getSegments

```tsx
getSegments: () => ReadonlyArray<{left: number; width: number}>
getSegments: () => ReadonlyArray<{ left: number; width: number }>
```

Segments to be rendered. Each `segment` has the following props:
- `left: number` - Percentage value of where segment should start on ranger
- `width: number` - Percentage value of segment width

- `left: number` - Percentage value of where segment should start on ranger
- `width: number` - Percentage value of segment width
9 changes: 6 additions & 3 deletions docs/framework/react/api/logarithmic-interpolator.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ menu: API
---

## Examples

Want to skip to the implementation? Check out these examples:

- [logarithmic-interpolator](../examples/logarithmic-interpolator)
- [logarithmic-interpolator](https://tanstack.com/ranger/latest/docs/framework/react/examples/logarithmic-interpolator)

The API below described how to use the **logarithmic-interpolator** features.

Expand All @@ -23,6 +24,8 @@ interpolator: {
getValueForClientX: (clientX: number, trackDims: object, min: number, max: number): number;
}
```

The Interpolator to use. Defaults to the bundled linear-scale interpolator
- `getPercentageForValue` - Takes the value & range and returns a percentage [0, 100] where the value sits from left to right.
- `getValueForClientX`- Takes the clientX (offset from the left edge of the ranger) along with the dimensions and range settings and transforms a pixel coordinate back into a value.

- `getPercentageForValue` - Takes the value & range and returns a percentage [0, 100] where the value sits from left to right.
- `getValueForClientX`- Takes the clientX (offset from the left edge of the ranger) along with the dimensions and range settings and transforms a pixel coordinate back into a value.
4 changes: 3 additions & 1 deletion docs/framework/react/api/update-on-drag.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ menu: API
---

## Examples

Want to skip to the implementation? Check out these examples:

- [update-on-drag](../../examples/react/update-on-drag)
- [update-on-drag](https://tanstack.com/ranger/latest/docs/framework/react/examples/update-on-drag)

The API below described how to use the **update-on-drag** features.

Expand All @@ -18,4 +19,5 @@ The API below described how to use the **update-on-drag** features.
```ts
onDrag: (instance: Ranger<TTrackElement>) => void
```

A function that is called when a handled is dragged