default.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. """Welcome to Reflex! This file outlines the steps to create a basic app."""
  2. from rxconfig import config
  3. import reflex as rx
  4. docs_url = "https://pynecone.io/docs/getting-started/introduction"
  5. filename = f"{config.app_name}/{config.app_name}.py"
  6. class State(rx.State):
  7. """The app state."""
  8. pass
  9. def index() -> rx.Component:
  10. return rx.fragment(
  11. rx.color_mode_button(rx.color_mode_icon(), float="right"),
  12. rx.vstack(
  13. rx.heading("Welcome to Reflex!", font_size="2em"),
  14. rx.box("Get started by editing ", rx.code(filename, font_size="1em")),
  15. rx.link(
  16. "Check out our docs!",
  17. href=docs_url,
  18. border="0.1em solid",
  19. padding="0.5em",
  20. border_radius="0.5em",
  21. _hover={
  22. "color": rx.color_mode_cond(
  23. light="rgb(107,99,246)",
  24. dark="rgb(179, 175, 255)",
  25. )
  26. },
  27. ),
  28. spacing="1.5em",
  29. font_size="2em",
  30. padding_top="10%",
  31. ),
  32. )
  33. # Add state and page to the app.
  34. app = rx.App(state=State)
  35. app.add_page(index)
  36. app.compile()