
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
bootstrap-tabs
Advanced tools
Extends an input text field to store multiple values. This library works by duplicating the input element you provide it in order to keep your existing form elements intact. Values are then written back to your original input as a comma separated (customisable) string.
It is assumed Bootstrap (tested with ^5.3.3) is already installed in your project.
npm i bootstrap-tabs
Create an instance:
import { BootstrapTabs } from "bootstrap-tabs";
let tabs = new BootstrapTabs(document.getElementById("input-field"));
You can also provide a settings object as the second parameter to provide customisation. All settings are optional.
| Setting | Type | Default | Notes |
|---|---|---|---|
allowDuplicates | boolean | false | Pass in true to allow duplicate entries, default is false |
valueSeparator | string | ',' | Provide a custom value separator when written back to the original input's value attribute |
sortItems | boolean | false | Enables or disables the default sort (Calls the built in array sort() function) |
sort | (a: string, b: string) => number; | null | Provide a custom sort callback to order the tabs how you wish. Providing this value overrides the sortItems value. |
beforeAdd | (text: string) => boolean; | null | Provide a callback function which returns a boolean to validate the newly created tab. This can be used to discard tabs before they're created |
disableDelete | boolean | false | Set this to true to hide the delete button within each tab |
tabContentRenderer | (text: string, index: number) => string; | <span>${text}</span> | Provide a function that returns an HTML string containing the contents of the tab to render. |
deleteContentRenderer | (text: string, index: number) => string; | <i class="bi bi-x-circle"></i> | Provide a function that returns an HTML string containing the contents of the delete button within each tab to render. By default this uses the bootstrap-icons library bi-x-circle icon, so this function can be used to override this behaviour |
tabClassList | Array<string> | ["badge", "bg-light", "text-dark"] | The list of additional classes to be added to the tab. You can provide these as a way to fully customise how the tabs look. (Note: If you specify this array, the default classes will not be added) |
deleteBtnClassList | Array<string> | ["btn", "btn-sm", "text-dark"] | The list of additional classes to be added to the delete button. You can provide these as a way to fully customise how the delete button looks. (Note: If you specify this array, the default classes will not be added) |
You can interact with your bootstrap-tabs instance in the following ways:
// Add a new tab (Note this will still execute the beforeAdd / sort settings parameters if provided):
const successfullyAdded = instance.addTab("<Tab value>");
// Remove a tab:
instance.removeTab("<Tab value>");
// Cleanup the instance by calling:
instance.dispose();
Both compiled CSS and the source SCSS is included in this package. You can from whichever works best for your project.
To import the SCSS into your worflow, you can add the following to your sass file:
@import "bootstrap-tabs/dist/scss/bootstrap-tabs";
If you're using vite you may need to add an alias to your vite.config.js:
export default defineConfig({
resolve: {
alias: {
'~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
'~bootstrap-tabs': path.resolve(__dirname, 'node_modules/bootstrap-tabs'),
}
},
...
and then import using the alias:
@import "~bootstrap-tabs/dist/scss/bootstrap-tabs";
FAQs
Extends an input text field to store multiple values
We found that bootstrap-tabs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.