Skip to content

Commit

Permalink
add expand parameter to ui.page_sticky (fixes #3671)
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Sep 4, 2024
1 parent 3f0d03b commit c3272b3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions nicegui/page_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,26 @@ def hide(self) -> None:

class PageSticky(Element):

def __init__(self, position: PageStickyPositions = 'bottom-right', x_offset: float = 0, y_offset: float = 0) -> None:
def __init__(self,
position: PageStickyPositions = 'bottom-right',
x_offset: float = 0,
y_offset: float = 0,
*,
expand: bool = False) -> None:
"""Page sticky
A sticky element that is always visible at the bottom of the page.
This element is based on Quasar's `QPageSticky <https://quasar.dev/layout/page-sticky>`_ component.
:param position: position of the sticky element (default: `'bottom-right'`)
:param x_offset: horizontal offset of the sticky element (default: `0`)
:param y_offset: vertical offset of the sticky element (default: `0`)
:param position: position on the screen (default: "bottom-right")
:param x_offset: horizontal offset (default: 0)
:param y_offset: vertical offset (default: 0)
:param expand: whether to fully expand instead of shrinking to fit the content (default: ``False``)
"""
super().__init__('q-page-sticky')
self._props['position'] = position
self._props['offset'] = [x_offset, y_offset]
if expand:
self._props['expand'] = True


def _check_current_slot(element: Element) -> None:
Expand Down

0 comments on commit c3272b3

Please sign in to comment.