Browse Source

add `expand` parameter to `ui.page_sticky` (fixes #3671)

Falko Schindler 8 months ago
parent
commit
c3272b3f55
1 changed files with 13 additions and 5 deletions
  1. 13 5
      nicegui/page_layout.py

+ 13 - 5
nicegui/page_layout.py

@@ -265,18 +265,26 @@ class Footer(ValueElement):
 
 
 class PageSticky(Element):
 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
         """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')
         super().__init__('q-page-sticky')
         self._props['position'] = position
         self._props['position'] = position
         self._props['offset'] = [x_offset, y_offset]
         self._props['offset'] = [x_offset, y_offset]
+        if expand:
+            self._props['expand'] = True
 
 
 
 
 def _check_current_slot(element: Element) -> None:
 def _check_current_slot(element: Element) -> None: