1
0
Эх сурвалжийг харах

adding documentation for row and column

Rodja Trappe 3 жил өмнө
parent
commit
0ebdd9df14

+ 12 - 0
main.py

@@ -267,6 +267,18 @@ with example(ui.card):
         with ui.card_section():
             ui.label('Lorem ipsum dolor sit amet, consectetur adipiscing elit, ...')
 
+with example(ui.column):
+    with ui.column():
+        ui.label('label 1')
+        ui.label('label 2')
+        ui.label('label 3')
+
+with example(ui.row):
+    with ui.row():
+        ui.label('label 1')
+        ui.label('label 2')
+        ui.label('label 3')
+
 binding = '''### Bindings
 
 With help of the [binding](https://pypi.org/project/binding/) package NiceGUI is able to directly bind UI elements to models.

+ 14 - 2
nicegui/elements/column.py

@@ -1,8 +1,20 @@
+from nicegui.elements.element import Design
 import justpy as jp
 from .group import Group
 
 class Column(Group):
-    def __init__(self):
-        view = jp.QDiv(classes='column items-start', style='gap: 1em', delete_flag=False)
+    def __init__(self, design: Design = Design.default):
+        '''Row Element
+
+        Provides a container which arranges it's child in a row.
+
+        :param design: Design.plain does not apply any stylings. If ommitted Design.default configures padding and spacing.
+        '''
+        if design == design.default:
+            view = jp.QDiv(classes='column items-start', style='gap: 1em', delete_flag=False)
+        elif design == design.plain:
+            view = jp.QDiv(classes='column', delete_flag=False)
+        else:
+            raise Exception(f'unsupported design: {design}')
 
         super().__init__(view)

+ 14 - 2
nicegui/elements/row.py

@@ -1,8 +1,20 @@
+from nicegui.elements.element import Design
 import justpy as jp
 from .group import Group
 
 class Row(Group):
-    def __init__(self):
-        view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False)
+    def __init__(self, design: Design = Design.default):
+        '''Row Element
+
+        Provides a container which arranges it's child in a row.
+
+        :param design: Design.plain does not apply any stylings. If ommitted Design.default configures padding and spacing.
+        '''
+        if design == design.default:
+            view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False)
+        elif design == design.plain:
+            view = jp.QDiv(classes='row', delete_flag=False)
+        else:
+            raise Exception(f'unsupported design: {design}')
 
         super().__init__(view)