{"id":13635394,"url":"https://github.com/juliandreas/vue-toggles","last_synced_at":"2025-04-19T04:30:58.056Z","repository":{"id":39117410,"uuid":"265816385","full_name":"juliandreas/vue-toggles","owner":"juliandreas","description":"A highly customizable and accessible toggle component for Vue","archived":false,"fork":false,"pushed_at":"2025-01-02T09:11:52.000Z","size":1220,"stargazers_count":50,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T23:16:05.693Z","etag":null,"topics":["vue","vue3","vuejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliandreas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"custom":["paypal.me/juliandreas"]}},"created_at":"2020-05-21T10:10:57.000Z","updated_at":"2025-03-09T07:15:43.000Z","dependencies_parsed_at":"2023-09-28T03:18:47.672Z","dependency_job_id":null,"html_url":"https://github.com/juliandreas/vue-toggles","commit_stats":{"total_commits":91,"total_committers":5,"mean_commits":18.2,"dds":0.1428571428571429,"last_synced_commit":"6af337c3a55652cd859ce4bbc2601b0afb443cc8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliandreas%2Fvue-toggles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliandreas%2Fvue-toggles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliandreas%2Fvue-toggles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliandreas%2Fvue-toggles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliandreas","download_url":"https://codeload.github.com/juliandreas/vue-toggles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249606269,"owners_count":21298851,"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":["vue","vue3","vuejs"],"created_at":"2024-08-02T00:00:45.029Z","updated_at":"2025-04-19T04:30:58.050Z","avatar_url":"https://github.com/juliandreas.png","language":"TypeScript","funding_links":["paypal.me/juliandreas"],"categories":["Components \u0026 Libraries","Components and plugins","UI Components [🔝](#readme)"],"sub_categories":["UI Components","Courses"],"readme":"\u003ch1 align=\"center\"\u003eVue Toggles\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\nA highly customizable and accessible toggle component for Vue 3.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/vue-toggles\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/vue-toggles.svg?style=flat-square\"/\u003e \u003cimg src=\"https://img.shields.io/npm/dt/vue-toggles.svg?style=flat-square\"/\u003e\u003c/a\u003e \u003ca href=\"https://vuejs.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/vue-3.x-brightgreen.svg?style=flat-square\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/juliandreas/vue-toggles/refs/heads/master/dev/public/vue-toggles.jpg\" alt=\"Vue Toggles Logo\"/\u003e\n\u003c/p\u003e\n\n## Introduction\n\nVue Toggles comes out of the box with accessibility support for:\n\n- `aria-checked` depending on state\n- `aria-readonly` if the toggle is disabled\n- `prefers-reduced-motion` if the user has requested any type of motion reduction [[prefers-reduced-motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion)]\n\n### Accessibility\n\nWhat's left for you, when it comes to accessibility, is labeling the toggle correctly. This is either done by:\n\n- A `\u003clabel for=\"example-id\"\u003eToggle description\u003c/label\u003e` followed by the toggle component `\u003cVueToggles id=\"example-id\" /\u003e`\n- Or an `aria-label`, for example `\u003cVueToggles aria-label=\"Toggle description\" /\u003e`. Remember, you still need a visual text description of what the toggle does\n\nThe focus-style is also left up to you - which you shouldn't remove. If you think the default is ugly, style it yourself!\n\n## Installation\n\n```\nnpm i vue-toggles\n```\n\n### Import component\n\n```javascript\nimport { VueToggles } from \"vue-toggles\";\n```\n\n### Import types\n\n```javascript\nimport type { VueTogglesProps } from \"vue-toggles\";\n```\n\n```javascript\nimport VueToggles, { type VueTogglesProps } from \"vue-toggles\";\n```\n\n## Usage\n\nThe toggle is very easy to use out of the box. The bare minimum for it to work is a `@click`-function and a `:value`-prop.\n\n```html\n\u003cVueToggles :value=\"isChecked\" @click=\"isChecked = !isChecked\" /\u003e\n```\n\nOr if you prefer the `v-model`-syntax:\n\n```html\n\u003cVueToggles v-model=\"isChecked\" /\u003e\n```\n\n## Options\n\nYou can also add more props to customize things like color and width/height.\n\n```html\n\u003cVueToggles\n  :value=\"value\"\n  :height=\"30\"\n  :width=\"90\"\n  checkedText=\"On\"\n  uncheckedText=\"Off\"\n  checkedBg=\"#b4d455\"\n  uncheckedBg=\"lightgrey\"\n  @click=\"value = !value\"\n/\u003e\n```\n\n## Properties\n\n| Name               | Type    | Default   | Description                                       |\n| ------------------ | ------- | --------- | ------------------------------------------------- |\n| value              | Boolean | `false`   | Initial state of the toggle button                |\n| disabled           | Boolean | `false`   | Toggle does not react on mouse or keyboard events |\n| reverse            | Boolean | `false`   | Reverse toggle to Right to Left                   |\n| width              | Number  | `75`      | Width of the toggle in `px`                       |\n| height             | Number  | `25`      | Height of the toggle in `px`                      |\n| dotColor           | String  | `#ffffff` | Color of the toggle dot                           |\n| dotSize            | Number  | `0`       | Dot size in `px`                                  |\n| checkedBg          | String  | `#5850ec` | Background color when the toggle is checked       |\n| uncheckedBg        | String  | `#939393` | Background color when the toggle is unchecked     |\n| checkedTextColor   | String  | `#ffffff` | Text color when the toggle is checked             |\n| uncheckedTextColor | String  | `#ffffff` | Text color when the toggle is unchecked           |\n| uncheckedText      | String  | `\"\"`      | Optional text when the toggle is unchecked        |\n| checkedText        | String  | `\"\"`      | Optional text when the toggle is checked          |\n| fontSize           | Number  | `12`      | Font size in `px`                                 |\n| fontWeight         | String  | `normal`  | Font weight                                       |\n\n## Vue 2 support\n\nIf you're looking for Vue 2 support, the `1.1.4`version is available [here](https://www.npmjs.com/package/vue-toggles/v/1.1.4).\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliandreas%2Fvue-toggles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliandreas%2Fvue-toggles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliandreas%2Fvue-toggles/lists"}