
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
pagination-ross
Advanced tools
Pagination-ross is a lightweight and flexible pagination component designed for React applications. It gives developers full control over styling without enforcing any default look, making it perfect for clean, customizable UIs
Un componente de paginación para React, fácil de usar y personalizable.
npm install pagination-ross
import Pagination from "pagination-ross";
function App() {
return (
<Pagination
currentPage={3}
totalPages={10}
onPageChange={(page) => console.log("Nueva página:", page)}
/>
);
}
Aquí tienes una lógica básica para paginar tu lista de ítems:
const itemsPerPage = 5;
const currentPage = Number(page); // page index empieza en 1
// Calcular total de páginas
const totalItems = listItems.length;
const totalPages = Math.ceil(totalItems / itemsPerPage);
// Obtener los ítems de la página actual
const startIndex = (currentPage - 1) * itemsPerPage;
const endIndex = startIndex + itemsPerPage;
const currentItems = listItems.slice(startIndex, endIndex);
// Manejador para cambiar de página
function handleClick(page: number) {
console.log(String(page));
}
Propiedad | Tipo | Requerido | Descripción |
---|---|---|---|
currentPage | number | Sí | Página actual que está siendo visualizada. |
totalPages | number | Sí | Número total de páginas disponibles. |
onPageChange | (page: number) => void | No | Callback que se ejecuta al cambiar de página. |
className | string | No | Clase CSS para el contenedor principal. |
style | React.CSSProperties | No | Estilos en línea para el contenedor principal. |
colorIcon | string | No | Color de los íconos de navegación. Por defecto: "#18181b". |
buttonClassName | string | No | Clase CSS para los botones de navegación (anterior/siguiente). |
listClassName | string | No | Clase CSS para el <ul> que contiene los botones de página. |
itemClassName | string | No | Clase CSS para cada ítem de paginación (<li> ). |
activeItemClassName | string | No | Clase CSS para el ítem activo (página actual). |
ellipsisClassName | string | No | Clase CSS para los ítems que muestran puntos suspensivos ("..."). |
Puedes combinar esto con el componente:
<Pagination
currentPage={1}
totalPages={5}
onPageChange={handleClick}
buttonClassName="buttonClass"
listClassName="listClass"
itemClassName="itemClass"
activeItemClassName="activeItemClass"
ellipsisClassName="ellipsisClass"
/>
MIT
FAQs
Pagination-ross is a lightweight and flexible pagination component designed for React applications. It gives developers full control over styling without enforcing any default look, making it perfect for clean, customizable UIs
The npm package pagination-ross receives a total of 8 weekly downloads. As such, pagination-ross popularity was classified as not popular.
We found that pagination-ross demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.