Skip to content

pagination

probo.styles.frameworks.bs5.components.pagination

BS5Pagination

Bases: BS5Component

A manager for Bootstrap 5 Pagination components.

Pagination is used to indicate a series of related content exists across multiple pages. This class handles the construction of the navigation wrapper, the unordered list of page items, and the contextual 'Previous' and 'Next' controls.

Attributes:

Name Type Description
attrs Dict[str, Any]

Attributes for the root

pagination_items List[BS5Element]

Collection of rendered page items.

position str

Horizontal alignment ('start', 'center', 'end').

pagination_classes List[str]

Resolved CSS classes for the

    element.

prev_item Optional[BS5Element]

The element for the 'Previous' control.

next_item Optional[BS5Element]

The element for the 'Next' control.

tag str

The HTML tag for the root container (defaults to 'div').

lg property

Upgrades the pagination to large size.

Returns:

Name Type Description
Self Self

Enables fluent method chaining.

sm property

Downgrades the pagination to small size.

Returns:

Name Type Description
Self Self

Enables fluent method chaining.

__init__(*items, position='start', render_constraints=None, **attrs)

Initializes the pagination with items and alignment logic.

Parameters:

Name Type Description Default
*items Any

Initial labels or elements to be used as page numbers.

()
position str

Alignment of the pagination block.

'start'
render_constraints dict

State validation properties.

None
**attrs Any

Attributes for the root

{}

add_controls(prev_content='Previous', prev_link='#', next_content='Next', next_link='#')

Defines the navigation controls for the pagination block.

Parameters:

Name Type Description Default
prev_content str

Label for the previous button.

'Previous'
prev_link str

URL for the previous button.

'#'
next_content str

Label for the next button.

'Next'
next_link str

URL for the next button.

'#'

Returns:

Name Type Description
Self Self

Enables fluent method chaining.

add_page_item(**content_link)

Adds multiple page items via keyword arguments.

Parameters:

Name Type Description Default
**content_link str

Key-value pairs where key is the label and value is the target URL.

{}

Returns:

Name Type Description
Self Self

Enables fluent method chaining.

before_render(**props)

Pre-processes the component structure before final rendering.

This method configures the template as a