|
@@ -14,25 +14,21 @@ def main_demo() -> None:
|
|
|
@doc.demo('Card without shadow', '''
|
|
|
You can remove the shadow from a card by adding the `no-shadow` class.
|
|
|
The following demo shows a 1 pixel wide border instead.
|
|
|
+
|
|
|
+ Alternatively, you can use Quasar's "flat" and "bordered" props to achieve the same effect.
|
|
|
''')
|
|
|
def card_without_shadow() -> None:
|
|
|
with ui.card().classes('no-shadow border-[1px]'):
|
|
|
ui.label('See, no shadow!')
|
|
|
|
|
|
+ with ui.card().props('flat bordered'):
|
|
|
+ ui.label('Also no shadow!')
|
|
|
|
|
|
-@doc.demo('The issue with nested borders', '''
|
|
|
- The following example shows a table nested in a card.
|
|
|
- Cards have a default padding in NiceGUI, so the table is not flush with the card's border.
|
|
|
- The table has the `flat` and `bordered` props set, so it should have a border.
|
|
|
- However, due to the way QCard is designed, the border is not visible (first card).
|
|
|
- There are two ways to fix this:
|
|
|
-
|
|
|
- - To get the original QCard behavior, use the `tight` method (second card).
|
|
|
- It removes the padding and the table border collapses with the card border.
|
|
|
-
|
|
|
- - To preserve the padding _and_ the table border, move the table into another container like a `ui.row` (third card).
|
|
|
|
|
|
- See https://github.com/zauberzeug/nicegui/issues/726 for more information.
|
|
|
+@doc.demo('Tight card layout', '''
|
|
|
+ By default, cards have a padding.
|
|
|
+ You can remove the padding and gaps between nested elements by using the `tight` method.
|
|
|
+ This also hides outer borders and shadows of nested elements, like in an original QCard.
|
|
|
''')
|
|
|
def custom_context_menu() -> None:
|
|
|
columns = [{'name': 'age', 'label': 'Age', 'field': 'age'}]
|
|
@@ -45,9 +41,5 @@ def custom_context_menu() -> None:
|
|
|
with ui.card().tight():
|
|
|
ui.table(columns, rows).props('flat bordered')
|
|
|
|
|
|
- with ui.card():
|
|
|
- with ui.row():
|
|
|
- ui.table(columns, rows).props('flat bordered')
|
|
|
-
|
|
|
|
|
|
doc.reference(ui.card)
|