@supercat1337/baredom-bootstrap-components
v1.0.3
Published
Reusable UI components built with baredom and Bootstrap 5
Downloads
498
Maintainers
Readme
@supercat1337/baredom-bootstrap-components
Reusable UI components built with baredom and Bootstrap 5.
Features
- Lightweight, direct DOM manipulation with
baredom. - Fully compatible with Bootstrap 5 CSS and JavaScript.
- Type-safe with JSDoc and TypeScript definitions.
- ESM modules with tree-shaking support.
- No build tools required for your app – just import and use.
Installation
npm install @supercat1337/baredom-bootstrap-componentsPeer Dependencies
Make sure you have baredom and bootstrap installed in your project:
npm install baredom bootstrapQuick Start
import { Pagination, Table, ModalConfirm } from '@supercat1337/baredom-bootstrap-components';
import 'bootstrap/dist/css/bootstrap.min.css';
// Create a pagination control
const pagination = new Pagination({ currentPage: 2, totalPages: 10 });
pagination.onPageClick(page => console.log('Page clicked:', page));
pagination.mount('#pagination-container');
// Create a table
const table = new Table({
columns: [
{ field: 'id', header: 'ID' },
{ field: 'name', header: 'Name' },
{ field: 'email', header: 'Email' },
],
data: [
{ id: 1, name: 'Alice', email: '[email protected]' },
{ id: 2, name: 'Bob', email: '[email protected]' },
],
});
table.mount('#table-container');Components
- Pagination – A Bootstrap pagination control.
- Table – A flexible data table with loading, empty, and error states.
- ModalConfirm – A confirmation modal with async handler.
- ModalForm – A modal with a form slot and submit logic.
- Modal – Simple informational modal.
- NavPanel – A navigation panel with menu items and badges.
- LanguageSwitcher – A language switcher dropdown with flag support.
Utilities
The library also exports helper functions:
renderPaginationElement(currentPage, totalPages, urlBuilder, onClick)– low-level pagination renderer.buttonStatusWaitingOn(button, waitingText)– set button to loading state.buttonStatusWaitingOff(button, originalText?)– restore button from loading.
Development
Clone the repository and install dependencies:
git clone https://github.com/supercat1337/baredom-bootstrap-components
cd baredom-bootstrap-components
npm installBuild the library:
npm run buildWatch mode:
npm run watchContributing
Contributions are welcome! Please open an issue or pull request on GitHub.
License
MIT
