# @fouita/pagination

> Simple pagination component built with svelte and tailwindcss

Latest version **0.0.2** (published 2021-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fouita/pagination
pnpm add @fouita/pagination
yarn add @fouita/pagination
bun add @fouita/pagination
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-04-07 |
| First published | 2020-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 56.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | fouita |
| Maintainers | fouita |
| Keywords | svelte, tailwind, fouita, pagination |

## Links

- npm: https://www.npmjs.com/package/@fouita/pagination
- Repository: https://github.com/fouita/svelte-tw-pagination
- Homepage: https://github.com/fouita/svelte-tw-pagination#readme
- Issues: https://github.com/fouita/svelte-tw-pagination/issues
- npm.io page: https://npm.io/package/@fouita/pagination

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2021-04-07
- 0.0.1 — 2020-09-11

## README

# Responsive Svelte + Tailwind Pagination component

Simple pagination component built with svelte and tailwindcss 

## Installation
```bash
    $npm i @fouita/pagination -D
```

## Simple usage

![fouita pagination](https://cdn.fouita.com/assets/pics/template/pagination/pagination-simple.png)

```html
<script>
    import Pagination from '@fouita/pagination'
    let current =1
    let num_items=30
    let per_page=3
</script>

<Pagination bind:current={current} {num_items} {per_page} />
```

## Style rounded

![fouita pagination rounded](https://cdn.fouita.com/assets/pics/template/pagination/pagination-rounded.png)

```html
<Pagination rounded bind:current={current} {num_items} {per_page} />
```


## Change Size to small

![fouita pagination small](https://cdn.fouita.com/assets/pics/template/pagination/pagination-small.png)

```html
<Pagination small rounded bind:current={current} {num_items} {per_page} />
```

## Change Color

You can use a color from tailwindcss list `(gray, red, blue, indigo, pink, purple, teal, orange, yellow)`

![fouita pagination small](https://cdn.fouita.com/assets/pics/template/pagination/pagination-color.png)

```html
<Pagination small rounded color="pink" bind:current={current} {num_items} {per_page} />
```


## Per page selection

You can add

![fouita pagination selection](https://cdn.fouita.com/assets/pics/template/pagination/pagination_per_page.png)

```html
<script>
	import Pagination from '@fouita/pagination'

	let current =1
	let num_items=30
	let per_page=3	
</script>
	
<div class="flex justify-between items-center">
	<div class="flex items-center">
		Per page:
		<select class="border px-2 rounded ml-2" bind:value={per_page}>
			<option>3</option>
			<option>5</option>
			<option>10</option>
		</select>
	</div>
	<Pagination small  bind:current={current} {num_items} per_page={per_page} />
</div>			  
```

## Navigate Action

if you like to perform some actions or API requests when navigating through pages, you can do so by calling `on:navigate` event.

```html
<script>
	import Pagination from '@fouita/pagination'

	let current =1
	let num_items=30
	let per_page=3	
	
	// let list_fetch = ... your init data
	async function changePage(evt){
		current = evt.detail
		// list_fetched = ... FETCH DATA HERE
	}
</script>

<Pagination small {current} {num_items} per_page={per_page} on:navigate={changePage} />
```


## About

[Fouita : UI framework for svelte + tailwind components](https://fouita.com)

---
_Source: https://npm.io/package/@fouita/pagination · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
