Pagination(ui_pagination)
UiBibz::Ui::Core::Navigations::Pagination
Pagination is a component to allow navigation between multiple pages.
Usage
This component is an extension of component element. A Ui Bibz component consists of 3 arguments:
ui_pagination options, html_options do |n|
# by variable
n.link content, options, html_options
# or by block
n.link options, html_options do
content
end
end
Examples
Some examples explain how to use the options present in the component.Pagination
ui_pagination do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
<ul class="pagination">
<li class="disabled page-item">
<a class="page-link" href="#<<">«</a>
</li>
<li class="active page-item">
<a class="page-link" href="#<<">1</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#2">2</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#3">3</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#4">4</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#5">5</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#6">6</a>
</li>
<li class="page-item">
<a class="page-link" href="#>>">»</a>
</li>
</ul>
Size
The
size
option has following symbols for argument:- :lg
- :md
- :sm
ui_pagination size: :lg do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
ui_pagination size: :md do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
ui_pagination size: :sm do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
<ul class="pagination pagination-lg">
<li class="disabled page-item">
<a class="page-link" href="#<<">«</a>
</li>
<li class="active page-item">
<a class="page-link" href="#<<">1</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#2">2</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#3">3</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#4">4</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#5">5</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#6">6</a>
</li>
<li class="page-item">
<a class="page-link" href="#>>">»</a>
</li>
</ul>
Position
The
position
option has following symbols for argument:- :left
- :center
- :right
ui_pagination size: :left do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
ui_pagination size: :center do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
ui_pagination size: :right do |n|
n.link '«', url: '#<<', state: :disabled
n.link 1, url: '#<<', state: :active
n.link 2, url: '#2', class: 'my-link'
n.link 3, url: '#3', class: 'my-link'
n.link 4, url: '#4', class: 'my-link'
n.link 5, url: '#5', class: 'my-link'
n.link 6, url: '#6', class: 'my-link'
n.link '»', url: '#>>'
end
<ul class="pagination">
<li class="disabled page-item">
<a class="page-link" href="#<<">«</a>
</li>
<li class="active page-item">
<a class="page-link" href="#<<">1</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#2">2</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#3">3</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#4">4</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#5">5</a>
</li>
<li class="my-link page-item">
<a class="page-link" href="#6">6</a>
</li>
<li class="page-item">
<a class="page-link" href="#>>">»</a>
</li>
</ul>