card.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. from typing_extensions import Self
  2. from ..element import Element
  3. class Card(Element):
  4. def __init__(self) -> None:
  5. """Card
  6. This element is based on Quasar's `QCard <https://quasar.dev/vue-components/card>`_ component.
  7. It provides a container with a dropped shadow.
  8. Note:
  9. There are subtle differences between the Quasar component and this element.
  10. In contrast to this element, the original QCard has no padding by default and hides outer borders of nested elements.
  11. If you want the original behavior, use the `tight` method.
  12. If you want the padding and borders for nested children, move the children into another container.
  13. """
  14. super().__init__('q-card')
  15. self._classes.append('nicegui-card')
  16. def tight(self) -> Self:
  17. """Remove padding and gaps between nested elements."""
  18. return self.classes('nicegui-card-tight')
  19. class CardSection(Element):
  20. def __init__(self) -> None:
  21. """Card Section
  22. This element is based on Quasar's `QCardSection <https://quasar.dev/vue-components/card#qcardsection-api>`_ component.
  23. """
  24. super().__init__('q-card-section')
  25. class CardActions(Element):
  26. def __init__(self) -> None:
  27. """Card Actions
  28. This element is based on Quasar's `QCardActions <https://quasar.dev/vue-components/card#qcardactions-api>`_ component.
  29. """
  30. super().__init__('q-card-actions')