center.py 490 B

1234567891011121314151617181920212223242526
  1. """A center component."""
  2. from __future__ import annotations
  3. from typing import Any
  4. from .flex import Flex
  5. class Center(Flex):
  6. """A center component."""
  7. def add_style(self) -> dict[str, Any] | None:
  8. """Add style that center the content.
  9. Returns:
  10. The style of the component.
  11. """
  12. return {
  13. "display": "flex",
  14. "align_items": "center",
  15. "justify_content": "center",
  16. }
  17. center = Center.create