{"id":24911428,"url":"https://github.com/accessible-ui/slider","last_synced_at":"2025-07-08T05:07:05.430Z","repository":{"id":40794969,"uuid":"230689863","full_name":"accessible-ui/slider","owner":"accessible-ui","description":"🅰 An accessible and versatile slider component for React that uses a native \u003cinput type=range\u003e for focus management","archived":false,"fork":false,"pushed_at":"2023-01-06T02:23:08.000Z","size":1865,"stargazers_count":4,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-02T22:38:46.257Z","etag":null,"topics":["a11y","a11y-slider","accessibility","accessible","accessible-react","accessible-slider","focus-management","react-accessibility","slider","slider-component"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/accessibleslider-example-vi94o","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/accessible-ui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-29T01:50:15.000Z","updated_at":"2021-04-26T17:54:42.000Z","dependencies_parsed_at":"2023-02-05T03:01:19.338Z","dependency_job_id":null,"html_url":"https://github.com/accessible-ui/slider","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Fslider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Fslider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Fslider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Fslider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/accessible-ui","download_url":"https://codeload.github.com/accessible-ui/slider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236750114,"owners_count":19198813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y","a11y-slider","accessibility","accessible","accessible-react","accessible-slider","focus-management","react-accessibility","slider","slider-component"],"created_at":"2025-02-02T04:20:06.811Z","updated_at":"2025-02-02T04:20:07.506Z","avatar_url":"https://github.com/accessible-ui.png","language":"TypeScript","readme":"\u003chr\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e\n    \u0026lt;Slider\u0026gt;\n  \u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=@accessible/slider\"\u003e\n    \u003cimg alt=\"Bundlephobia\" src=\"https://img.shields.io/bundlephobia/minzip/@accessible/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Types\" href=\"https://www.npmjs.com/package/@accessible/slider\"\u003e\n    \u003cimg alt=\"Types\" src=\"https://img.shields.io/npm/types/@accessible/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Code coverage report\" href=\"https://codecov.io/gh/accessible-ui/slider\"\u003e\n    \u003cimg alt=\"Code coverage\" src=\"https://img.shields.io/codecov/c/gh/accessible-ui/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Build status\" href=\"https://travis-ci.org/accessible-ui/slider\"\u003e\n    \u003cimg alt=\"Build status\" src=\"https://img.shields.io/travis/accessible-ui/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"NPM version\" href=\"https://www.npmjs.com/package/@accessible/slider\"\u003e\n    \u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/@accessible/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"License\" href=\"https://jaredlunde.mit-license.org/\"\u003e\n    \u003cimg alt=\"MIT License\" src=\"https://img.shields.io/npm/l/@accessible/slider?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cpre align=\"center\"\u003enpm i @accessible/slider\u003c/pre\u003e\n\u003chr\u003e\n\nAn accessible and versatile slider component for React. These components are touchable and\nkeyboard navigable.\n\nThis library contains components for single-thumb sliders out of the box, though you could feasibly fashion a\ndual-thumb slider from what's here.\n\n## Quick Start\n\n[Check out the example on CodeSandbox](https://codesandbox.io/s/accessibleslider-example-vi94o)\n\n```jsx harmony\nimport {Slider, Track, Thumb} from '@accessible/slider'\n\nconst Component = () =\u003e (\n  \u003cSlider orientation=\"vertical\"\u003e\n    \u003cdiv className=\"slider\"\u003e\n      \u003cTrack\u003e\n        \u003cdiv className=\"track\"\u003e\n          \u003cThumb\u003e\n            \u003cdiv className=\"thumb\" /\u003e\n          \u003c/Thumb\u003e\n        \u003c/div\u003e\n      \u003c/Track\u003e\n    \u003c/div\u003e\n  \u003c/Slider\u003e\n)\n```\n\n## API\n\n### `\u003cSlider\u003e`\n\nCreates the context for your slider and configures it. This also creates the underlying\n`\u003cinput type='range'\u003e` component. Any props not listed below are provided to the `\u003cinput\u003e`.\n\n#### Props\n\n| Prop         | Type                                         | Default        | Required? | Description                                                                                                                                                                              |\n| ------------ | -------------------------------------------- | -------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| min          | `number`                                     | `0`            | Yes       | The minimum value of the slider                                                                                                                                                          |\n| max          | `number`                                     | `100`          | Yes       | The maximum value of the slider                                                                                                                                                          |\n| step         | `number`                                     | `1`            | Yes       | The amount the slider increases or decreases each time it is ticked                                                                                                                      |\n| value        | `number`                                     | `undefined`    | No        | Makes this component controlled. This is always the value of the slider. `incr`, `decr`, `set` and keyboard steps have no effect.                                                        |\n| defaultValue | `number`                                     | `50`           | No        | Sets the default value of the slider                                                                                                                                                     |\n| orientation  | \u003ccode\u003e\"horizontal\" \u0026#0124; \"vertical\"\u003c/code\u003e | `\"horizontal\"` | Yes       | Sets the orientation of the slider. When `horizontal` the minimum value is on the left, max on the right. When `vertical`, the minimum value is on the bottom and the max is on the top. |\n| disabled     | `boolean`                                    | `false`        | No        | Disables the slider `incr`, `decr`, `set`, and keyboard controls. You can still update the slider's value using the `value` prop.                                                        |\n| onChange     | `(value?: number) =\u003e any`                    | `undefined`    | No        | Called each time the `value` changes.                                                                                                                                                    |\n\n### `\u003cTrack\u003e`\n\nThis component attaches event handlers to its child that make it act like a native `\u003cinput type=\"range\"\u003e` track. It\nis your responsibility to style it.\n\n#### Props\n\n| Prop     | Type                 | Default     | Required? | Description                                                                                                                       |\n| -------- | -------------------- | ----------- | --------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| children | `React.ReactElement` | `undefined` | Yes       | Provides events to its child component that control the state of the slider's value depending on the current drag/click position. |\n\n### `\u003cThumb\u003e`\n\nThis component adds styles to its child that update the child's position within a track based upon the\nprogress of the slider i.e. `(value - min) / (max - min)`.\n\n#### Props\n\n| Prop     | Type                 | Default     | Required? | Description                                             |\n| -------- | -------------------- | ----------- | --------- | ------------------------------------------------------- |\n| children | `React.ReactElement` | `undefined` | Yes       | The child component you want to add progress styles to. |\n\n### `useSlider()`\n\nA hook that provides the slider's [`SliderContext`](#slidercontextvalue)\n\n### `SliderContextValue`\n\n```typescript jsx\ninterface SliderContextValue {\n  incr: (by?: number) =\u003e void\n  decr: (by?: number) =\u003e void\n  set: (value: number) =\u003e void\n  value: number\n  min: number\n  max: number\n  step: number\n  focused: boolean\n  disabled: boolean\n  orientation: 'horizontal' | 'vertical'\n  inputRef: React.MutableRefObject\u003cHTMLInputElement | null\u003e\n}\n```\n\n### `useValue()`\n\nA hook that returns the slider's current `value`\n\n### `useProgress()`\n\nA hook that returns the value of `(value - min) / (max - min)`\n\n### `useOrientation()`\n\nA hook that returns the slider's current orientation\n\n### `useFocused()`\n\nA hook that returns `true` if the slider is `focused`\n\n### `useDisabled()`\n\nA hook that returns `true` if the slider is `disabled`\n\n### `useControls()`\n\nA hook that provide's the slider's `incr`, `decr`, and `set` functions\n\n## LICENSE\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccessible-ui%2Fslider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccessible-ui%2Fslider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccessible-ui%2Fslider/lists"}