Skip to main content

Pagination

Struct Pagination 

Source
pub struct Pagination { /* private fields */ }
Expand description

Pagination component for navigating through pages

Styled like shadcn/ui Pagination with previous/next buttons and page numbers.

§Example

use armas_basic::Pagination;

let resp = Pagination::new(1, 10).show(ui);
// current_page is the current page after any user interaction

Implementations§

Source§

impl Pagination

Source

pub fn new(initial_page: usize, total_pages: usize) -> Self

Create a new pagination component

§Arguments
  • initial_page - Initial/current page (1-indexed)
  • total_pages - Total number of pages
Source

pub fn id(self, id: impl Into<Id>) -> Self

Set ID for state persistence

Source

pub const fn sibling_count(self, count: usize) -> Self

Set the number of sibling pages to show on each side of current page

Source

pub const fn show_prev_next(self, show: bool) -> Self

Show or hide previous/next buttons

Source

pub const fn button_size(self, button_size: f32) -> Self

Set the size of page number and ellipsis buttons

Source

pub fn show(self, ui: &mut Ui) -> PaginationResponse

Show the pagination and return PaginationResponse

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.