{"id":17315983,"url":"https://github.com/bmsvieira/bvselect-vanillajs","last_synced_at":"2025-04-14T13:32:03.972Z","repository":{"id":111617648,"uuid":"266447546","full_name":"BMSVieira/BVSelect-VanillaJS","owner":"BMSVieira","description":"BVSelect - Vanilla Javascript Fully Customizable SelectBox","archived":false,"fork":false,"pushed_at":"2021-10-15T08:55:37.000Z","size":833,"stargazers_count":120,"open_issues_count":12,"forks_count":18,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:53:25.647Z","etag":null,"topics":["customizable","javascript","javascript-es6","nojquery","opensource","purejavascript","selectbox","vanilla-javascript","vanillajs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/BMSVieira.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-24T01:16:28.000Z","updated_at":"2025-02-24T22:36:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"571372f0-f969-4eb9-81fb-33bd27e1a5ff","html_url":"https://github.com/BMSVieira/BVSelect-VanillaJS","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BMSVieira%2FBVSelect-VanillaJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BMSVieira%2FBVSelect-VanillaJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BMSVieira%2FBVSelect-VanillaJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BMSVieira%2FBVSelect-VanillaJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BMSVieira","download_url":"https://codeload.github.com/BMSVieira/BVSelect-VanillaJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248888734,"owners_count":21178100,"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":["customizable","javascript","javascript-es6","nojquery","opensource","purejavascript","selectbox","vanilla-javascript","vanillajs"],"created_at":"2024-10-15T13:11:14.017Z","updated_at":"2025-04-14T13:32:03.345Z","avatar_url":"https://github.com/BMSVieira.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"BVSelect - Vanilla JS\n--\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"500\" src=\"https://bmsvieira.github.io/BVSelect-VanillaJS/demo-template/images/BV.png\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\nReplaces native select elements with fully customizable dropdowns.\n\u003c/p\u003e\n\nDemo:\n-\nhttps://bmsvieira.github.io/BVSelect-VanillaJS/\n\nFeatures:\n-\n- 🔧 Fully Customizable\n- 💪 No Dependencies, built with VanillaJS\n- 🌎 Tested in All Modern Browsers\n- 😎 Images \u0026 FontIcons\n- ⌨️ Mobile Optimization \u0026 Normal Usage\n- 🔎 Built-in Searchbox\n- 🖥 Prevented Viewport Overflow\n\nInstallation:\n-\n\n1 - Include JavaScript Source.\n```javascript\n\u003cscript src=\"path/to/bvselect.js\"\u003e\u003c/script\u003e\n```\n2 - Include Styles.\n```javascript\n\u003clink rel=\"stylesheet\" href=\"path/to/bvselect.css\"\u003e\n```\n4 - Set HTML.\n```javascript\n\u003cselect id=\"selectbox\"\u003e\n  \u003coption data-separator=\"true\"\u003e Select Option \u003c/option\u003e\n  \u003coption value=\"1\"\u003e Option 1 \u003c/option\u003e\n  \u003coption value=\"2\"\u003e Option 2 \u003c/option\u003e\n  \u003coption value=\"3\" disabled\u003e Option 3 \u003c/option\u003e\n  \u003coption value=\"4\"\u003e Option 4 \u003c/option\u003e\n\u003c/select\u003e\n```\n3 - Initilize.\n```javascript\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n      var demo1 = new BVSelect({\n        selector: \"#selectbox\",\n        width: \"100%\",\n        searchbox: true,\n        offset: true,\n        placeholder: \"Select Option\",\n        search_placeholder: \"Search...\",\n        search_autofocus: true,\n        breakpoint: 450\n      });\n});\n```\nPolyfill:\n-\nBVSelect uses ES6 which isn't supported in all browsers yet (especially older browsers). Some features will need to be polyfilled to be available. Use the following sources instead:\n```javascript\n// Polyfill Source\n\u003cscript src=\"https://polyfill.io/v3/polyfill.min.js?features=document.querySelector%2Cdocument%2CArray.prototype.forEach%2CNodeList.prototype.forEach%2CElement.prototype.closest%2CArray.from%2Ces5\"\u003e\u003c/script\u003e\n\n// BVSelect Polyfilled Version\n\u003cscript src=\"path/to/bvselect.polyfill.js\"\u003e\u003c/script\u003e\n```\n\nMethods:\n-\n\n\u003cb\u003eDestroy:\u003c/b\u003e\nRemoves dropdown, unbinds all its events and brings back the original Select.\n\n```javascript\ndemo1.Destroy();\n```\n\n\u003cb\u003eUpdate:\u003c/b\u003e\nUpdates current dropdown based on changes to the original selectbox.\n\n```javascript\ndemo1.Update();\n```\n\n\u003cb\u003eGet ID:\u003c/b\u003e\nReturns the ID that was generated to build dropdown, so you can add custom classes.\n\n```javascript\ndemo1.GetID();\n```\n\n\u003cb\u003eSet Option:\u003c/b\u003e\nSet new selected option.\n\n| Name | Value | Description |\n| --- | --- | --- |\n| `type` | `byIndex` or `byValue` | Parameter |\n| `value` | `string` | Value to search |\n\n```javascript\ndemo1.SetOption({\n  type: \"byIndex\",\n  value: \"1\"\n});\n```\n\n\u003cb\u003eChange:\u003c/b\u003e\nChanges dropdown's settings\n\n| Name | Value | Description |\n| --- | --- | --- |\n| `placeholder` | `string` | Modify dropdown's placeholder |\n| `search_placeholder` | `string` | Modify input's placelholder |\n| `options` | `object` | Replaces all options in the original selectbox |\n\n```javascript\ndemo1.Change({\n  placeholder: \"New Placeholder\",\n  search_placeholder: \"New Searchbox's Placeholder\",\n  options : {\n          0: {\n              inner_text: 'Metallica',\n              value: \"met\",\n              disabled: false,\n              separator: false,\n              img: \"https://img.icons8.com/color/2x/usa.png\",\n              icon: \"fa fa-hashtag\"\n          },\n          1: {\n              inner_text: 'Megadeth',\n              value: \"meg\",\n              disabled: false,\n              separator: false,\n              img: false,\n              icon: \"fa fa-tshirt\"\n          },\n          2: {\n              inner_text: 'Slayer',\n              value: \"sla\",\n              disabled: false,\n              separator: false,\n              img: false,\n              icon: \"fa fa-hashtag\"\n          }  \n    }\n});\n\n// Update Dropdown based on changes to the original selectbox\ndemo1.Update();\n```\n\n\u003cb\u003eAppend Option:\u003c/b\u003e\nAdd new options to existing selectbox\n\n| Name | Value | Description |\n| --- | --- | --- |\n| `position` | `afterbegin` or `beforeend` | Add new options at beginning or ending of the dropdown |\n| `options` | `object` | Options to add to original selectbox |\n\n```javascript\ndemo1.AppendOption({\n    position: \"beforeend\",\n    options : {\n            0: {\n                inner_text: 'Metallica',\n                value: \"met\",\n                disabled: false,\n                separator: false,\n                img: \"https://img.icons8.com/color/2x/usa.png\",\n                icon: \"fa fa-hashtag\"\n            },\n            1: {\n                inner_text: 'Megadeth',\n                value: \"meg\",\n                disabled: false,\n                separator: false,\n                img: false,\n                icon: \"fa fa-tshirt\"\n            }\n      }\n  });\n\n// Update Dropdown based on changes to the original selectbox\ndemo1.Update();\n```\n\nSettings:\n-\n| Name | Value | Default | Description |\n| --- | --- | --- | --- |\n| `selector` | `ID`  | `---` |  Specify ID of the element|\n| `width` | `px` or `%` | `100%` |  Specify the width of the main element|\n| `searchbox` | `boolean` | `false` |  Add a search box to the list |\n| `offset` | `boolean` | `true` | Fixes Viewport Offset |\n| `placeholder` | `string` | `Select Option` | Modify dropdown's placeholder |\n| `search_placeholder` | `string` | `Search...` | Modify input's placelholder |\n| `search_autofocus` | `boolean` | `false` | Automatically focus on search input if enabled |\n| `breakpoint` | `integer` | `600` | Defines the responsive breakpoint (in px) |\n\n```javascript\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n      var demo1 = new BVSelect({\n        selector: \"#selectbox\",\n        searchbox: true,\n        offset: true\n      });\n});\n```\nAttributes:\n-\n| Name | Value | Description |\n| --- | --- | --- |\n| `data-separator` | `boolean` | Highlights an option |\n| `data-img` | `Image Source` |  Adds an Image to option |\n| `data-icon` | `fa fa-hashtag` |  Adds an FontIcon to option, can be used any provider as long it is identical. Images will be prioritized over icons. |\n| `disabled (native)` | `disabled` |  Disables an option |\n\n*To add FontIcons, you must include it's own sources*\n\n```html\n\u003cselect id=\"selectbox\"\u003e\n    \u003coption value=\"##\" data-separator=\"true\" selected\u003eSelect Option\u003c/option\u003e\n    \u003coption data-img=\"path/to/img.png\" value=\"--\"\u003eCristiano Ronaldo\u003c/option\u003e\n    \u003coption data-icon=\"fa fa-hashtag\" value=\"--\" \u003eLionel Messi \u003c/option\u003e\n    \u003coption data-img=\"path/to/img.png\" value=\"--\" disabled\u003eNeymar Jr. (Disabled)\u003c/option\u003e\n    \u003coption data-img=\"path/to/img.png\" value=\"--\"\u003eRonaldinho\u003c/option\u003e\n    \u003coption data-img=\"path/to/img.png\" value=\"--\"\u003eLuis Figo\u003c/option\u003e\n\u003c/select\u003e\n```\n*All CSS styles are fully customizable in order to match your style*\n\nAppearance\n-\nThis was built to fit any style and to be 100% fully customizable, so you are able to change everything in the css file.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"800\" src=\"https://i.imgur.com/oj0VAJm.png\"\u003e\n\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmsvieira%2Fbvselect-vanillajs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmsvieira%2Fbvselect-vanillajs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmsvieira%2Fbvselect-vanillajs/lists"}