instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
h.stem
comp.__module__ = doc_module
comp.__name__ = doc_file
comp.__qualname__ = doc_file
return docpage(set_path=route, t=title2)(comp)
doc_routes = [
library,
custom_components,
overview,
*components_previews_pages,
*apiref_pages,
*cloud_cliref_pages,
# * ai_builder_pages,
*cloud_pages,
]
for cloud_page in cloud_pages:
title = rx.utils.format.to_snake_case(cloud_page.title)
build_nested_namespace(docs_ns, ["cloud"], title, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
|
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# pr | route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}") |
_path=route, t=title2)(comp)
doc_routes = [
library,
custom_components,
overview,
*components_previews_pages,
*apiref_pages,
*cloud_cliref_pages,
# * ai_builder_pages,
*cloud_pages,
]
for cloud_page in cloud_pages:
title = rx.utils.format.to_snake_case(cloud_page.title)
build_nested_namespace(docs_ns, ["cloud"], title, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
|
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| if route.endswith("/index/"):
route = route[:-7] + "/" |
tes = [
library,
custom_components,
overview,
*components_previews_pages,
*apiref_pages,
*cloud_cliref_pages,
# * ai_builder_pages,
*cloud_pages,
]
for cloud_page in cloud_pages:
title = rx.utils.format.to_snake_case(cloud_page.title)
build_nested_namespace(docs_ns, ["cloud"], title, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
|
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| route = route[:-7] + "/" |
m_components,
overview,
*components_previews_pages,
*apiref_pages,
*cloud_cliref_pages,
# * ai_builder_pages,
*cloud_pages,
]
for cloud_page in cloud_pages:
title = rx.utils.format.to_snake_case(cloud_page.title)
build_nested_namespace(docs_ns, ["cloud"], title, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
|
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| comp = get_component(doc, title) |
d_page.title)
build_nested_namespace(docs_ns, ["cloud"], title, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
|
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library |
le, cloud_page)
for api_route in apiref_pages:
title = rx.utils.format.to_snake_case(api_route.title)
build_nested_namespace(docs_ns, ["api_reference"], title, api_route)
for ref in cloud_cliref_pages:
title = rx.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
|
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| locals()["library_"] = library |
x.utils.format.to_snake_case(ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
|
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp) |
ref.title)
build_nested_namespace(docs_ns, ["cloud"], title, ref)
for doc in sorted(flexdown_docs):
path = doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
|
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp) |
doc.split("/")[1:-1]
title = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
|
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc) |
e = rx.utils.format.to_snake_case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
|
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc) |
case(os.path.basename(doc).replace(".md", ""))
title2 = to_title_case(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
|
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns
| category = doc.split("/")[2] |
(title)
route = rx.utils.format.to_kebab_case(f"/{doc.replace('.md', '/')}")
# Handle index files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
| for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
locals()[name] = ns | |
x files: /folder/index/ -> /folder/
if route.endswith("/index/"):
route = route[:-7] + "/"
comp = get_component(doc, title)
# # Check if the path starts with '/docs/cloud/', and if so, replace 'docs' with an empty string
# if route.startswith("/docs/cloud/"):
# route = route.replace("/docs", "")
if path[0] == "library" and isinstance(library, Route):
locals()["library_"] = library
# print(route)
# Add the component to the nested namespaces.
build_nested_namespace(
docs_ns, path, title, Route(path=route, title=title2, component=lambda: "")
)
if comp is not None:
if isinstance(comp, tuple):
doc_routes.extend(comp)
else:
doc_routes.append(comp)
for doc in flexdown_docs:
if "recipes" in doc:
category = doc.split("/")[2]
recipes_list[category].append(doc)
for name, ns in docs_ns.__dict__.items():
# if name == "cloud":
# print(name, ns)
| locals()[name] = ns | |
"""Plugins API reference page."""
import reflex as rx
from pcweb.templates.docpage import docpage
@docpage("/docs/api-reference/plugins/")
def plugins():
"""Plugins API reference page."""
with open("docs/api-reference/plugins.md", encoding="utf-8") as f:
|
return rx.markdown(content)
| content = f.read() |
"""Utils API reference page."""
import reflex as rx
from pcweb.templates.docpage import docpage
@docpage("/docs/api-reference/utils/")
def utils():
"""Utils API reference page."""
with open("docs/api-reference/utils.md", encoding="utf-8") as f:
|
return rx.markdown(content)
| content = f.read() |
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| import reflex as rx | |
import reflex as rx
|
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from pcweb.components.icons.patterns import index_patterns |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
|
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from pcweb.meta.meta import meta_tags |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
|
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from pcweb.templates.mainpage import mainpage |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
|
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .demos.demos import demo_section |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
|
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.backend_features import backend_features |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
|
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.companies import companies |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
|
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.frontend_features import frontend_features |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
|
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.hero import hero |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
|
from .views.os_newsletter import os_newsletter
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.hosting_features import hosting_features |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
|
from .views.stats import stats
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.os_newsletter import os_newsletter |
import reflex as rx
from pcweb.components.icons.patterns import index_patterns
from pcweb.meta.meta import meta_tags
from pcweb.templates.mainpage import mainpage
from .demos.demos import demo_section
from .views.backend_features import backend_features
from .views.companies import companies
from .views.frontend_features import frontend_features
from .views.hero import hero
from .views.hosting_features import hosting_features
from .views.os_newsletter import os_newsletter
|
@mainpage(path="/open-source", title="Reflex · Web apps in Pure Python", meta=meta_tags)
def framework() -> rx.Component:
"""Get the main Reflex landing page."""
return rx.box(
*index_patterns(),
hero(),
demo_section(),
companies(),
frontend_features(),
backend_features(),
hosting_features(),
stats(),
os_newsletter(),
class_name="flex flex-col w-full justify-center items-center",
)
| from .views.stats import stats |
@rx.memo
def index_colors() -> rx.Component:
return rx.el.style(
"""
.light,
.light-theme {
/* Slate */
--c-slate-1: #FCFCFD;
--c-slate-2: #F9F9FB;
--c-slate-3: #E8E8EC;
--c-slate-4: #E8E8EC;
--c-slate-5: #E0E1E6;
--c-slate-6: #D9D9E0;
--c-slate-7: #CDCED6;
--c-slate-8: #B9BBC6;
--c-slate-9: #8B8D98;
--c-slate-10: #80838D;
--c-slate-11: #60646C;
--c-slate-12: #1C2024;
}
.dark,
.dark-theme {
/* Slate */
--c-slate-1: #151618;
--c-slate-2: #1A1B1D;
--c-slate-3: #222326;
--c-slate-4: #27282B;
--c-slate-5: #303236;
--c-slate-6: #4B4D53;
--c-slate-7: #5E5F69;
--c-slate-9: #9A9CAC;
--c-slate-8: #6E7287;
--c-slate-10: #D9D9E0;
--c-slate-11: #E0E1E6;
--c-slate-12: #FCFCFD;
}
""",
)
| import reflex as rx | |
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
from pcweb.pages.docs import getting_started
from pcweb.pages.framework.demos.demos import demo_section
def hero() -> rx.Component:
"""Render the hero section of the landing page."""
return rx.el.section(
# Headings
rx.box(
rx.el.h1(
"Build web apps in pure Python",
class_name="inline-block bg-clip-text bg-gradient-to-r from-slate-12 to-slate-11 w-full font-xx-large lg:font-xxx-large text-balance text-center text-transparent",
),
rx.el.h2(
rx.el.span("An open-source framework to ship beautiful apps fast."),
rx.el.span("Deploy with a single command."),
class_name="flex flex-col font-md text-center text-slate-9",
),
class_name="flex flex-col gap-6",
),
# Buttons
rx.box(
rx.link(
b | import reflex as rx | |
import reflex as rx
|
from pcweb.components.icons.icons import get_icon
from pcweb.pages.docs import getting_started
from pcweb.pages.framework.demos.demos import demo_section
def hero() -> rx.Component:
"""Render the hero section of the landing page."""
return rx.el.section(
# Headings
rx.box(
rx.el.h1(
"Build web apps in pure Python",
class_name="inline-block bg-clip-text bg-gradient-to-r from-slate-12 to-slate-11 w-full font-xx-large lg:font-xxx-large text-balance text-center text-transparent",
),
rx.el.h2(
rx.el.span("An open-source framework to ship beautiful apps fast."),
rx.el.span("Deploy with a single command."),
class_name="flex flex-col font-md text-center text-slate-9",
),
class_name="flex flex-col gap-6",
),
# Buttons
rx.box(
rx.link(
button(
"Get Started",
| from pcweb.components.button import button |
import reflex as rx
from pcweb.components.button import button
|
from pcweb.pages.docs import getting_started
from pcweb.pages.framework.demos.demos import demo_section
def hero() -> rx.Component:
"""Render the hero section of the landing page."""
return rx.el.section(
# Headings
rx.box(
rx.el.h1(
"Build web apps in pure Python",
class_name="inline-block bg-clip-text bg-gradient-to-r from-slate-12 to-slate-11 w-full font-xx-large lg:font-xxx-large text-balance text-center text-transparent",
),
rx.el.h2(
rx.el.span("An open-source framework to ship beautiful apps fast."),
rx.el.span("Deploy with a single command."),
class_name="flex flex-col font-md text-center text-slate-9",
),
class_name="flex flex-col gap-6",
),
# Buttons
rx.box(
rx.link(
button(
"Get Started",
class_name="!px-[1.125rem] !py-2 | from pcweb.components.icons.icons import get_icon |
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
|
from pcweb.pages.framework.demos.demos import demo_section
def hero() -> rx.Component:
"""Render the hero section of the landing page."""
return rx.el.section(
# Headings
rx.box(
rx.el.h1(
"Build web apps in pure Python",
class_name="inline-block bg-clip-text bg-gradient-to-r from-slate-12 to-slate-11 w-full font-xx-large lg:font-xxx-large text-balance text-center text-transparent",
),
rx.el.h2(
rx.el.span("An open-source framework to ship beautiful apps fast."),
rx.el.span("Deploy with a single command."),
class_name="flex flex-col font-md text-center text-slate-9",
),
class_name="flex flex-col gap-6",
),
# Buttons
rx.box(
rx.link(
button(
"Get Started",
class_name="!px-[1.125rem] !py-2 !h-12 !font-smbold !text-[1.125rem] !leading | from pcweb.pages.docs import getting_started |
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
from pcweb.pages.docs import getting_started
|
def hero() -> rx.Component:
"""Render the hero section of the landing page."""
return rx.el.section(
# Headings
rx.box(
rx.el.h1(
"Build web apps in pure Python",
class_name="inline-block bg-clip-text bg-gradient-to-r from-slate-12 to-slate-11 w-full font-xx-large lg:font-xxx-large text-balance text-center text-transparent",
),
rx.el.h2(
rx.el.span("An open-source framework to ship beautiful apps fast."),
rx.el.span("Deploy with a single command."),
class_name="flex flex-col font-md text-center text-slate-9",
),
class_name="flex flex-col gap-6",
),
# Buttons
rx.box(
rx.link(
button(
"Get Started",
class_name="!px-[1.125rem] !py-2 !h-12 !font-smbold !text-[1.125rem] !leading-[1.625rem] !tracking-[-0.01688rem] transition-bg rounded-[ | from pcweb.pages.framework.demos.demos import demo_section |
from pcweb.components.icons.icons import get_icon
@rx.memo
def stat(stat: str, text: str) -> rx.Component:
return rx.el.section(
get_icon("feather"),
rx.box(
rx.text(
stat,
class_name="font-x-large inline-block bg-clip-text bg-gradient-to-r from-slate-8 via-slate-9 to-slate-8 w-full text-balance text-center text-transparent",
),
rx.text(text, class_name="font-small text-slate-9"),
class_name="flex flex-col justify-center items-center text-center text-nowrap",
),
get_icon("feather", class_name="scale-x-[-1]"),
class_name="flex flex-row items-center gap-4 justify-center",
)
| import reflex as rx | |
import reflex as rx
|
@rx.memo
def stat(stat: str, text: str) -> rx.Component:
return rx.el.section(
get_icon("feather"),
rx.box(
rx.text(
stat,
class_name="font-x-large inline-block bg-clip-text bg-gradient-to-r from-slate-8 via-slate-9 to-slate-8 w-full text-balance text-center text-transparent",
),
rx.text(text, class_name="font-small text-slate-9"),
class_name="flex flex-col justify-center items-center text-center text-nowrap",
),
get_icon("feather", class_name="scale-x-[-1]"),
class_name="flex flex-row items-center gap-4 justify-center",
)
| from pcweb.components.icons.icons import get_icon |
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="pyt | import reflex as rx | |
import reflex as rx
|
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded- | from pcweb.components.icons.icons import get_icon |
import reflex as rx
from pcweb.components.icons.icons import get_icon
|
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def p | from .charts.charts import charts, charts_code |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
|
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
| from .chatbot.chatbot import chatbot, chatbot_code |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
|
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class | from .forms.forms import form, form_code |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
|
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full", | from .image_gen.image_gen import image_gen, image_gen_code |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
|
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "sla | from .react.react import react, react_code |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
|
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
| class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
|
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
| demo = "Forms" |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
|
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
| def set_demo(self, demo):
self.demo = demo |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
|
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
| self.demo = demo |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
|
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
tab("Chatbot", "chat_bubble"),
tab("Image Gen", "image_ai_small"),
| is_selected = DemoState.demo == name |
import reflex as rx
from pcweb.components.icons.icons import get_icon
from .charts.charts import charts, charts_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
|
def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
)
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
tab("Chatbot", "chat_bubble"),
tab("Image Gen", "image_ai_small"),
tab("Charts", "chart"),
tab("Custom", "code_custom"),
class_name="flex flex-row lg:items-center overflow-hidden border-slate-4 border-b lg:justify-center divide-x divide-slate-4 [&>:first-child]:border-l-slate-4 [&>:last-child]:!border-r-slate-4 lg:[&>:first-child]:!border-l lg:[&>:last-child]:!border-r flex-nowrap overflow-x-auto justify-start",
),
# Previews
rx.box(
rx.box(
rx.match(
DemoState.demo,
("Forms", form(color)),
("Chatbot", chatbot()),
| def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
) |
_code
from .chatbot.chatbot import chatbot, chatbot_code
from .forms.forms import form, form_code
from .image_gen.image_gen import image_gen, image_gen_code
from .react.react import react, react_code
class DemoState(rx.State):
demo = "Forms"
@rx.event
def set_demo(self, demo):
self.demo = demo
def tab(name: str, icon: str) -> rx.Component:
is_selected = DemoState.demo == name
return rx.box(
get_icon(icon, class_name="!text-slate-9 shrink-0"),
name,
class_name="box-border flex flex-row justify-center items-center gap-2 hover:bg-slate-3 px-3 py-2 h-full font-small text-slate-9 transition-bg cursor-pointer text-nowrap"
+ rx.cond(is_selected, " bg-slate-1 lg:shadow-large", ""),
on_click=DemoState.set_demo(name),
)
def code_block(code: str) -> rx.Component:
return rx._x.code_block(
code,
language="python",
class_name="demo-code-block !rounded-none !text-slate-12 no-scrollbar",
)
|
def demo_section(color: str = "slate") -> rx.Component:
return rx.box(
# Tabs
rx.box(
tab("Forms", "send"),
tab("Chatbot", "chat_bubble"),
tab("Image Gen", "image_ai_small"),
tab("Charts", "chart"),
tab("Custom", "code_custom"),
class_name="flex flex-row lg:items-center overflow-hidden border-slate-4 border-b lg:justify-center divide-x divide-slate-4 [&>:first-child]:border-l-slate-4 [&>:last-child]:!border-r-slate-4 lg:[&>:first-child]:!border-l lg:[&>:last-child]:!border-r flex-nowrap overflow-x-auto justify-start",
),
# Previews
rx.box(
rx.box(
rx.match(
DemoState.demo,
("Forms", form(color)),
("Chatbot", chatbot()),
("Image Gen", image_gen()),
("Charts", charts()),
("Custom", react()),
image_gen(),
| def preview_block() -> rx.Component:
return rx.box(
rx.text("Preview"),
class_name="flex justify-center items-center p-8 w-full h-full",
) |
import reflex as rx
from pcweb.components.button import button_with_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State): | import random | |
import random
|
from pcweb.components.button import button_with_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State):
data = data
| import reflex as rx |
import random
import reflex as rx
|
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State):
data = data
@rx.event
def randomize_data(self):
self. | from pcweb.components.button import button_with_icon |
import random
import reflex as rx
from pcweb.components.button import button_with_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
|
def charts():
return rx.box(
rx.el.style(
"""
.recharts-tooltip-item-unit {
display: none;
}
.recharts-tooltip-item-value {
font-family: "JetBrains Mono", monospace;
color: var(--c-slate-12);
}
.recharts-tooltip-item:first-child .recharts-tooltip-item-name {
color: var(--c-violet-9);
}
.recharts-tooltip-item:nth-child(2) .recharts-tooltip-item-name {
color: var(--c-slate-10);
}
.recharts-tooltip-item-list {
margin-top: 4px !important;
}
"""
),
button_with_icon(
"Randomize",
"dice",
variant="muted",
on_click=ChartsState.randomize_data,
class_name="!bg-slate-5 !border-t-[rgba(255,255,255,0.05)] !rounded-[0.625rem] hover:!bg-slate-6 !text-slate-9 gap-2",
),
rx.recharts.area_chart(
rx.recharts.area(
data_key="Desktop",
stroke=rx.color("slate", 6),
fill=rx.color("slate", 3),
| class ChartsState(rx.State):
data = data
@rx.event
def randomize_data(self):
self.data = [
{
"month": item["month"],
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
}
for item in self.data
] |
ort reflex as rx
from pcweb.components.button import button_with_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State):
|
@rx.event
def randomize_data(self):
self.data = [
{
"month": item["month"],
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
}
for item in self.data
]
def charts():
return rx.box(
rx.el.style(
"""
.recharts-tooltip-item-unit {
display: none;
}
.recharts-tooltip-item-value {
font-family: "JetBrains Mono", monospace;
color: var(--c-slate-12);
}
.recharts-tooltip-item:first-child .recharts-tooltip-item-name {
color: var(--c-violet-9);
}
.recharts-tooltip-item:nth-child(2) .recharts-tooltip-item-name {
color: var(--c-slate-10);
}
.recharts-tooltip-item-list {
margin-top: 4px !important;
}
"""
),
button_with_icon(
"Randomize",
"dice",
variant="muted",
on_click=ChartsState.randomize_data,
class_name="!bg-slate-5 !border-t-[rgba(255,25 | data = data |
mponents.button import button_with_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State):
data = data
@rx.event
|
def charts():
return rx.box(
rx.el.style(
"""
.recharts-tooltip-item-unit {
display: none;
}
.recharts-tooltip-item-value {
font-family: "JetBrains Mono", monospace;
color: var(--c-slate-12);
}
.recharts-tooltip-item:first-child .recharts-tooltip-item-name {
color: var(--c-violet-9);
}
.recharts-tooltip-item:nth-child(2) .recharts-tooltip-item-name {
color: var(--c-slate-10);
}
.recharts-tooltip-item-list {
margin-top: 4px !important;
}
"""
),
button_with_icon(
"Randomize",
"dice",
variant="muted",
on_click=ChartsState.randomize_data,
class_name="!bg-slate-5 !border-t-[rgba(255,255,255,0.05)] !rounded-[0.625rem] hover:!bg-slate-6 !text-slate-9 gap-2",
),
rx.recharts.area_chart(
rx.recharts.area(
data_key="Desktop",
stroke=rx.color("slate", 6),
fill=rx.color("slate", 3),
| def randomize_data(self):
self.data = [
{
"month": item["month"],
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
}
for item in self.data
] |
_icon
data = [
{
"month": "Jan",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Feb",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Mar",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Apr",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "May",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jun",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
{
"month": "Jul",
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
},
]
class ChartsState(rx.State):
data = data
@rx.event
def randomize_data(self):
|
def charts():
return rx.box(
rx.el.style(
"""
.recharts-tooltip-item-unit {
display: none;
}
.recharts-tooltip-item-value {
font-family: "JetBrains Mono", monospace;
color: var(--c-slate-12);
}
.recharts-tooltip-item:first-child .recharts-tooltip-item-name {
color: var(--c-violet-9);
}
.recharts-tooltip-item:nth-child(2) .recharts-tooltip-item-name {
color: var(--c-slate-10);
}
.recharts-tooltip-item-list {
margin-top: 4px !important;
}
"""
),
button_with_icon(
"Randomize",
"dice",
variant="muted",
on_click=ChartsState.randomize_data,
class_name="!bg-slate-5 !border-t-[rgba(255,255,255,0.05)] !rounded-[0.625rem] hover:!bg-slate-6 !text-slate-9 gap-2",
),
rx.recharts.area_chart(
rx.recharts.area(
data_key="Desktop",
stroke=rx.color("slate", 6),
fill=rx.color("slate", 3),
| self.data = [
{
"month": item["month"],
"Mobile": random.randint(100, 500),
"Desktop": random.randint(400, 700),
}
for item in self.data
] |
# state.py
import os
|
from openai import AsyncOpenAI
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self: | import reflex as rx |
# state.py
import os
import reflex as rx
|
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history. | from openai import AsyncOpenAI |
# state.py
import os
import reflex as rx
from openai import AsyncOpenAI
|
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
| from pcweb.components.icon_button import icon_button |
# state.py
import os
import reflex as rx
from openai import AsyncOpenAI
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
|
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yie | question = form_data["question"] |
# state.py
import os
import reflex as rx
from openai import AsyncOpenAI
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
|
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str | client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"]) |
# state.py
import os
import reflex as rx
from openai import AsyncOpenAI
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
|
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(ans | session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
) |
# state.py
import os
import reflex as rx
from openai import AsyncOpenAI
from pcweb.components.icon_button import icon_button
class TutorialState(rx.State):
# Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
|
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-v | answer = "" |
Keep track of the chat history as a list of (question, answer) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
|
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-violet-3 max-w-[60%] mr-[20%] text-start self-start",
),
class_name="flex flex-col gap-4 w-full",
)
def chatbot() -> rx.Component:
return rx.box(
rx.el.button(
rx.icon(
tag="trash",
size=22,
class_name="shrink-0",
),
class_name="!text-slate-11 rounded-[10px] hover:bg-slate-3 p-2 self-end shrink-0",
on_click=TutorialState.clear_chat,
),
rx.box(
rx.auto_scroll(
rx.foreach(
TutorialState | if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield |
) tuples.
chat_history: list[tuple[str, str]] = [
(
"What is Reflex?",
"Reflex is the open-source framework empowering Python developers to build web apps faster.",
)
]
@rx.event(background=True)
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
|
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-violet-3 max-w-[60%] mr-[20%] text-start self-start",
),
class_name="flex flex-col gap-4 w-full",
)
def chatbot() -> rx.Component:
return rx.box(
rx.el.button(
rx.icon(
tag="trash",
size=22,
class_name="shrink-0",
),
class_name="!text-slate-11 rounded-[10px] hover:bg-s | if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break |
async def submit(self, form_data: dict):
question = form_data["question"]
# Our chatbot has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
|
yield
@rx.event
def clear_chat(self):
self.chat_history = []
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-violet-3 max-w-[60%] mr-[20%] text-start self-start",
),
class_name="flex flex-col gap-4 w-full",
)
def chatbot() -> rx.Component:
return rx.box(
rx.el.button(
rx.icon(
tag="trash",
size=22,
class_name="shrink-0",
),
class_name="!text-slate-11 rounded-[10px] hover:bg-slate-3 p-2 self-end shrink-0",
on_click=TutorialState.clear_chat,
),
rx.box(
rx.auto_scroll(
rx.foreach(
| self.chat_history[-1] = (self.chat_history[-1][0], answer) |
has some brains now!
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
|
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-violet-3 max-w-[60%] mr-[20%] text-start self-start",
),
class_name="flex flex-col gap-4 w-full",
)
def chatbot() -> rx.Component:
return rx.box(
rx.el.button(
rx.icon(
tag="trash",
size=22,
class_name="shrink-0",
),
class_name="!text-slate-11 rounded-[10px] hover:bg-slate-3 p-2 self-end shrink-0",
on_click=TutorialState.clear_chat,
),
rx.box(
rx.auto_scroll(
rx.foreach(
TutorialState.chat_history,
lambda messages: qa(messages[0], mess | def clear_chat(self):
self.chat_history = [] |
client = AsyncOpenAI(api_key=os.environ["OPENAI_API_KEY"])
session = await client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
stop=None,
temperature=0.7,
stream=True,
)
# Add to the answer as the chatbot responds.
answer = ""
# self.chat_history = []
async with self:
self.chat_history.append((question, answer))
yield
async for item in session:
if hasattr(item.choices[0].delta, "content"):
if item.choices[0].delta.content is None:
# presence of 'None' indicates the end of the response
break
answer += item.choices[0].delta.content
async with self:
self.chat_history[-1] = (self.chat_history[-1][0], answer)
yield
@rx.event
def clear_chat(self):
|
def qa(question: str, answer: str) -> rx.Component:
return rx.box(
rx.box(
rx.text(question),
class_name="font-base text-slate-10 rounded-lg p-2 bg-slate-3 ml-[20%] text-end self-end",
),
rx.box(
rx.text(answer),
class_name="font-base text-violet-10 rounded-lg p-2 bg-violet-3 max-w-[60%] mr-[20%] text-start self-start",
),
class_name="flex flex-col gap-4 w-full",
)
def chatbot() -> rx.Component:
return rx.box(
rx.el.button(
rx.icon(
tag="trash",
size=22,
class_name="shrink-0",
),
class_name="!text-slate-11 rounded-[10px] hover:bg-slate-3 p-2 self-end shrink-0",
on_click=TutorialState.clear_chat,
),
rx.box(
rx.auto_scroll(
rx.foreach(
TutorialState.chat_history,
lambda messages: qa(messages[0], mess | self.chat_history = [] |
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons import get_icon
from pcweb.signup import IndexState
def form(color: str = "slate") -> rx.Component:
return rx.box(
rx.form(
rx.box(
rx.box(
get_icon("message_form", class_name=f"text-{color}-9"),
class_name="size-14 rounded-full bg-slate-5 flex items-center justify-center shrink-0",
),
rx.box(
rx.text(
"Join Newsletter",
class_name="font-md-smbold text-slate-12 leading-6",
),
rx.text(
"Get the latest updates and news about Reflex.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col gap-1",
),
class_name="flex flex-row gap-5 items-center",
| from __future__ import annotations | |
from __future__ import annotations
|
from pcweb.components.button import button
from pcweb.components.icons import get_icon
from pcweb.signup import IndexState
def form(color: str = "slate") -> rx.Component:
return rx.box(
rx.form(
rx.box(
rx.box(
get_icon("message_form", class_name=f"text-{color}-9"),
class_name="size-14 rounded-full bg-slate-5 flex items-center justify-center shrink-0",
),
rx.box(
rx.text(
"Join Newsletter",
class_name="font-md-smbold text-slate-12 leading-6",
),
rx.text(
"Get the latest updates and news about Reflex.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col gap-1",
),
class_name="flex flex-row gap-5 items-center",
),
| import reflex as rx |
from __future__ import annotations
import reflex as rx
|
from pcweb.components.icons import get_icon
from pcweb.signup import IndexState
def form(color: str = "slate") -> rx.Component:
return rx.box(
rx.form(
rx.box(
rx.box(
get_icon("message_form", class_name=f"text-{color}-9"),
class_name="size-14 rounded-full bg-slate-5 flex items-center justify-center shrink-0",
),
rx.box(
rx.text(
"Join Newsletter",
class_name="font-md-smbold text-slate-12 leading-6",
),
rx.text(
"Get the latest updates and news about Reflex.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col gap-1",
),
class_name="flex flex-row gap-5 items-center",
),
rx.box(
rx.text(
| from pcweb.components.button import button |
from __future__ import annotations
import reflex as rx
from pcweb.components.button import button
|
from pcweb.signup import IndexState
def form(color: str = "slate") -> rx.Component:
return rx.box(
rx.form(
rx.box(
rx.box(
get_icon("message_form", class_name=f"text-{color}-9"),
class_name="size-14 rounded-full bg-slate-5 flex items-center justify-center shrink-0",
),
rx.box(
rx.text(
"Join Newsletter",
class_name="font-md-smbold text-slate-12 leading-6",
),
rx.text(
"Get the latest updates and news about Reflex.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col gap-1",
),
class_name="flex flex-row gap-5 items-center",
),
rx.box(
rx.text(
"Name ",
rx | from pcweb.components.icons import get_icon |
from __future__ import annotations
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons import get_icon
|
def form(color: str = "slate") -> rx.Component:
return rx.box(
rx.form(
rx.box(
rx.box(
get_icon("message_form", class_name=f"text-{color}-9"),
class_name="size-14 rounded-full bg-slate-5 flex items-center justify-center shrink-0",
),
rx.box(
rx.text(
"Join Newsletter",
class_name="font-md-smbold text-slate-12 leading-6",
),
rx.text(
"Get the latest updates and news about Reflex.",
class_name="font-small text-slate-9",
),
class_name="flex flex-col gap-1",
),
class_name="flex flex-row gap-5 items-center",
),
rx.box(
rx.text(
"Name ",
rx.text.span("*", class_name="text-red | from pcweb.signup import IndexState |
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
| import reflex as rx | |
import reflex as rx
|
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
| import replicate |
import reflex as rx
import replicate
|
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
| from pcweb.components.button import button |
import reflex as rx
import replicate
from pcweb.components.button import button
|
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
| from pcweb.components.icons import get_icon |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
|
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_a | prompt = form_data["prompt"] |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
|
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("imag | if prompt == "":
return |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
|
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
| self.processing = True |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
|
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
class_name="flex justify-center items-center bo | input = {"prompt": prompt} |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
|
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
class_name="flex justify-center items-center border-slate-4 border bg-slate-3 w-full h-full rounded-2xl",
),
),
class_name="h-full w-full flex justify | output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
) |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
|
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
class_name="flex justify-center items-center border-slate-4 border bg-slate-3 w-full h-full rounded-2xl",
),
),
class_name="h-full w-full flex justify-center items-center overflow-hidden rounded-2xl aspect-square",
| self.image_url = str(output[0]) |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
|
finally:
async with self:
self.processing = False
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
class_name="flex justify-center items-center border-slate-4 border bg-slate-3 w-full h-full rounded-2xl",
),
),
class_name="h-full w-full flex justify-center items-center overflow-hidden rounded-2xl aspect-square",
),
loading=ImageGenState.processing,
class_name="rounded-xl w-full | self.image_url = "" |
import reflex as rx
import replicate
from pcweb.components.button import button
from pcweb.components.icons import get_icon
class ImageGenState(rx.State):
"""The app state."""
image_url: str = ""
processing: bool = False
@rx.event(background=True)
async def get_image(self, form_data):
"""Get the image from the prompt."""
prompt = form_data["prompt"]
if prompt == "":
return
async with self:
self.processing = True
yield
input = {"prompt": prompt}
try:
output = await replicate.async_run(
"black-forest-labs/flux-schnell",
input=input,
)
async with self:
self.image_url = str(output[0])
except Exception:
async with self:
self.image_url = ""
finally:
async with self:
|
def image_gen() -> rx.Component:
return rx.box(
rx.skeleton(
rx.box(
rx.cond(
ImageGenState.image_url,
rx.image(
src=ImageGenState.image_url,
class_name="w-auto h-auto object-contain object-center rounded-2xl",
),
rx.box(
get_icon("image_ai"),
# rx.icon("image", size=26, class_name="!text-slate-7"),
class_name="flex justify-center items-center border-slate-4 border bg-slate-3 w-full h-full rounded-2xl",
),
),
class_name="h-full w-full flex justify-center items-center overflow-hidden rounded-2xl aspect-square",
),
loading=ImageGenState.processing,
class_name="rounded-xl w-full h-full",
),
rx.form(
rx.el.input(
placehol | self.processing = False |
class Spline(rx.Component):
"""Spline component."""
# The name of the npm package.
library = "@splinetool/react-spline"
# Any additional libraries needed to use the component.
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
# The name of the component to use from the package.
tag = "Spline"
# Spline is a default export from the module.
is_default = True
# Class name for the component.
class_name: rx.Var[str] = "rounded-[1.125rem]"
# Any props that the component takes.
scene: rx.Var[str]
# Convenience function to create the Spline component.
spline = Spline.create
# Use the Spline component in your app.
def react():
return rx.box(
spline(
scene="https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode",
),
class_name="p-4 lg:px-10 lg:py-12 h-full overflow-hidden",
)
react_code = """import reflex as rx
class Spline(rx.Component):
library = "@splinetool/react | import reflex as rx | |
import reflex as rx
class Spline(rx.Component):
"""Spline component."""
# The name of the npm package.
|
# Any additional libraries needed to use the component.
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
# The name of the component to use from the package.
tag = "Spline"
# Spline is a default export from the module.
is_default = True
# Class name for the component.
class_name: rx.Var[str] = "rounded-[1.125rem]"
# Any props that the component takes.
scene: rx.Var[str]
# Convenience function to create the Spline component.
spline = Spline.create
# Use the Spline component in your app.
def react():
return rx.box(
spline(
scene="https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode",
),
class_name="p-4 lg:px-10 lg:py-12 h-full overflow-hidden",
)
react_code = """import reflex as rx
class Spline(rx.Component):
library = "@splinetool/react-spline"
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
tag = "Spline"
is_default = True
scene: rx.Var[str | library = "@splinetool/react-spline" |
import reflex as rx
class Spline(rx.Component):
"""Spline component."""
# The name of the npm package.
library = "@splinetool/react-spline"
# Any additional libraries needed to use the component.
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
# The name of the component to use from the package.
|
# Spline is a default export from the module.
is_default = True
# Class name for the component.
class_name: rx.Var[str] = "rounded-[1.125rem]"
# Any props that the component takes.
scene: rx.Var[str]
# Convenience function to create the Spline component.
spline = Spline.create
# Use the Spline component in your app.
def react():
return rx.box(
spline(
scene="https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode",
),
class_name="p-4 lg:px-10 lg:py-12 h-full overflow-hidden",
)
react_code = """import reflex as rx
class Spline(rx.Component):
library = "@splinetool/react-spline"
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
tag = "Spline"
is_default = True
scene: rx.Var[str]
spline = Spline.create
scene = "https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode"
def spline_demo():
return spline(scene=scene)
"""
| tag = "Spline" |
import reflex as rx
class Spline(rx.Component):
"""Spline component."""
# The name of the npm package.
library = "@splinetool/react-spline"
# Any additional libraries needed to use the component.
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
# The name of the component to use from the package.
tag = "Spline"
# Spline is a default export from the module.
|
# Class name for the component.
class_name: rx.Var[str] = "rounded-[1.125rem]"
# Any props that the component takes.
scene: rx.Var[str]
# Convenience function to create the Spline component.
spline = Spline.create
# Use the Spline component in your app.
def react():
return rx.box(
spline(
scene="https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode",
),
class_name="p-4 lg:px-10 lg:py-12 h-full overflow-hidden",
)
react_code = """import reflex as rx
class Spline(rx.Component):
library = "@splinetool/react-spline"
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
tag = "Spline"
is_default = True
scene: rx.Var[str]
spline = Spline.create
scene = "https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode"
def spline_demo():
return spline(scene=scene)
"""
| is_default = True |
import reflex as rx
class Spline(rx.Component):
"""Spline component."""
# The name of the npm package.
library = "@splinetool/react-spline"
# Any additional libraries needed to use the component.
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
# The name of the component to use from the package.
tag = "Spline"
# Spline is a default export from the module.
is_default = True
# Class name for the component.
class_name: rx.Var[str] = "rounded-[1.125rem]"
# Any props that the component takes.
scene: rx.Var[str]
# Convenience function to create the Spline component.
|
# Use the Spline component in your app.
def react():
return rx.box(
spline(
scene="https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode",
),
class_name="p-4 lg:px-10 lg:py-12 h-full overflow-hidden",
)
react_code = """import reflex as rx
class Spline(rx.Component):
library = "@splinetool/react-spline"
lib_dependencies: list[str] = ["@splinetool/runtime@1.5.5"]
tag = "Spline"
is_default = True
scene: rx.Var[str]
spline = Spline.create
scene = "https://prod.spline.design/1eapv4LnOygEqB66/scene.splinecode"
def spline_demo():
return spline(scene=scene)
"""
| spline = Spline.create |
from pcweb.components.icons.patterns import get_icon
def pip_install_card() -> rx.Component:
return rx.box(
# Glow
rx.html(
"""<svg width="320" height="120" viewBox="0 0 320 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M320 60C320 93.1371 248.366 120 160 120C71.6344 120 0 93.1371 0 60C0 26.8629 71.6344 0 160 0C248.366 0 320 26.8629 320 60Z" fill="url(#paint0_radial_10857_12655)"/>
<defs>
<radialGradient id="paint0_radial_10857_12655" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(160 60) rotate(90) scale(60 160)">
<stop stop-color="var(--c-violet-3)"/>
<stop offset="1" stop-color="var(--c-slate-2)" stop-opacity="0"/>
</radialGradient>
</defs>
</svg>
""",
class_name="w-[20rem] h-[7.5rem] shrink-0 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[-1] pointer-events-none",
),
# Radial background
rx.html(
"""<svg width="338" height="47 | import reflex as rx | |
import reflex as rx
|
def pip_install_card() -> rx.Component:
return rx.box(
# Glow
rx.html(
"""<svg width="320" height="120" viewBox="0 0 320 120" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M320 60C320 93.1371 248.366 120 160 120C71.6344 120 0 93.1371 0 60C0 26.8629 71.6344 0 160 0C248.366 0 320 26.8629 320 60Z" fill="url(#paint0_radial_10857_12655)"/>
<defs>
<radialGradient id="paint0_radial_10857_12655" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(160 60) rotate(90) scale(60 160)">
<stop stop-color="var(--c-violet-3)"/>
<stop offset="1" stop-color="var(--c-slate-2)" stop-opacity="0"/>
</radialGradient>
</defs>
</svg>
""",
class_name="w-[20rem] h-[7.5rem] shrink-0 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[-1] pointer-events-none",
),
# Radial background
rx.html(
"""<svg width="338" height="478" viewBox="0 0 338 478" fill="none" xmlns="http://www | from pcweb.components.icons.patterns import get_icon |
lass_name="shrink-0 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[-2] pointer-events-none",
),
# Pip install
rx.el.button(
get_icon("copy_pip", class_name="!text-violet-9"),
rx.el.p(
"$ pip install reflex",
class_name="font-['JetBrains_Mono'] font-bold text-[0.8125rem] text-center text-slate-9 leading-5 tracking-[-0.01219rem]",
),
on_click=rx.set_clipboard("pip install reflex"),
class_name="flex flex-row items-center gap-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-bg border border-solid border-slate-4 bg-[rgba(249,249,251,0.48)] dark:bg-[rgba(26,27,29,0.48)] hover:bg-[rgba(249,249,251,0.48)] dark:hover:bg-[rgba(26,27,29,0.48)] backdrop-filter backdrop-blur-[6px]",
),
class_name="lg:flex hidden h-full w-full justify-center items-center relative overflow-hidden row-span-2 lg:!border-r !border-slate-3 !border-t-0",
)
|
def backend_grid() -> rx.Component:
return rx.box(
rx.box(
rx.el.h2(
"Skip the boilerplate",
class_name="font-x-large text-slate-12 text-balance lg:text-nowrap",
),
rx.el.p(
"Seamless frontend-backend integration",
class_name="font-x-large text-slate-9 z-[1] text-balance lg:text-nowrap",
),
class_name="flex flex-col lg:border-l border-slate-3 lg:p-[5rem_6.5rem_5rem_2.5rem] lg:text-nowrap text-center lg:text-start pb-8 lg:pb-0 mt-12 lg:mt-0 col-span-1 lg:col-span-2",
),
pip_install_card(),
backend_card(
title="It's just Python",
description="Define and manage state with Python classes and functions",
icon="python",
class_name="lg:!border-l !border-slate-3",
),
backend_card(
title="PyPI",
description="Use any Python library with Reflex",
| def backend_card(
title: str,
description: str,
icon: str,
cols: str = "1",
class_name: str = "",
) -> rx.Component:
return rx.box(
rx.box(
rx.box(
get_icon(icon, class_name="!text-slate-9"),
rx.el.h3(title, class_name="font-base text-slate-9"),
class_name="flex flex-row items-center gap-2",
),
rx.el.p(description, class_name="font-md-smbold text-slate-11"),
class_name="flex flex-col gap-[0.875rem]",
),
class_name=f"col-span-{cols} h-[11rem] lg:h-[15rem] overflow-hidden p-8 w-full"
+ " "
+ class_name,
) |
title="PyPI",
description="Use any Python library with Reflex",
icon="package",
),
backend_card(
title="Database management",
description="Use our built-in database or connect your own with a single line",
icon="backend_db",
class_name="lg:!border-l lg:!border-b-0 !border-slate-3",
),
backend_card(
title="Auth",
description="Secure your app with any auth provider - no vendor lock-in",
icon="backend_auth",
class_name="lg:!border-b-0",
),
backend_card(
title="Check out the docs",
description="API routes, background jobs, shared state, file uploads, cookies and more...",
icon="document_code",
class_name="lg:!border-r !border-slate-3",
),
class_name="grid grid-cols-1 lg:grid-cols-3 gap-0 grid-rows-3 w-full divide-y divide-slate-3 lg:divide-x",
)
| def backend_features() -> rx.Component:
return rx.el.section(
rx.box(
backend_grid(),
class_name="flex flex-row max-w-[64.19rem] justify-center w-full",
),
class_name="flex flex-col justify-center items-center",
) | |
def logo(path: str, height: str) -> rx.Component:
return rx.fragment(
rx.image(
src=f"/companies/light/{path}.svg",
alt=f"{path} logo",
loading="lazy",
height=height,
class_name="shrink-0 dark:hidden",
),
rx.image(
src=f"/companies/dark/{path}.svg",
alt=f"{path} logo",
height=height,
loading="lazy",
class_name="shrink-0 dark:block hidden",
),
)
def companies() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.span(
"Trusted by industry leading teams",
class_name="px-2 py-0.5 font-small text-center text-slate-9",
),
class_name="flex flex-row justify-center items-center w-full",
),
rx.box(
logo("amazon", "34px"),
logo("nasa", "21px"),
logo("dell", "36px"),
logo("samsung", "26px"),
| import reflex as rx | |
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL
from pcweb.pages.docs import hosting
def card(
icon: str, heading: str, content: str, button_text: str, link: str
) -> rx.Component:
return rx.box(
get_icon(icon, class_name="!justify-start"),
rx.box(
rx.text(heading, class_name="font-md-smbold text-slate-11"),
rx.text(content, class_name="font-small text-slate-9 whitespace-pre"),
class_name="flex flex-col gap-2 mt-4 mb-6",
),
rx.link(
button(button_text, variant="secondary"),
href=link,
is_external=False,
underline="none",
),
class_name="flex flex-col border-slate-4 bg-slate-2 p-8 border rounded-[1.125rem]",
)
def deploy() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.h2(
"Deploy your app fast", class_name="fon | import reflex as rx | |
import reflex as rx
|
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL
from pcweb.pages.docs import hosting
def card(
icon: str, heading: str, content: str, button_text: str, link: str
) -> rx.Component:
return rx.box(
get_icon(icon, class_name="!justify-start"),
rx.box(
rx.text(heading, class_name="font-md-smbold text-slate-11"),
rx.text(content, class_name="font-small text-slate-9 whitespace-pre"),
class_name="flex flex-col gap-2 mt-4 mb-6",
),
rx.link(
button(button_text, variant="secondary"),
href=link,
is_external=False,
underline="none",
),
class_name="flex flex-col border-slate-4 bg-slate-2 p-8 border rounded-[1.125rem]",
)
def deploy() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.h2(
"Deploy your app fast", class_name="font-x-large gradient-heading"
),
| from pcweb.components.button import button |
import reflex as rx
from pcweb.components.button import button
|
from pcweb.constants import DISCORD_URL
from pcweb.pages.docs import hosting
def card(
icon: str, heading: str, content: str, button_text: str, link: str
) -> rx.Component:
return rx.box(
get_icon(icon, class_name="!justify-start"),
rx.box(
rx.text(heading, class_name="font-md-smbold text-slate-11"),
rx.text(content, class_name="font-small text-slate-9 whitespace-pre"),
class_name="flex flex-col gap-2 mt-4 mb-6",
),
rx.link(
button(button_text, variant="secondary"),
href=link,
is_external=False,
underline="none",
),
class_name="flex flex-col border-slate-4 bg-slate-2 p-8 border rounded-[1.125rem]",
)
def deploy() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.h2(
"Deploy your app fast", class_name="font-x-large gradient-heading"
),
rx.text(
"With our serv | from pcweb.components.icons.icons import get_icon |
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
|
from pcweb.pages.docs import hosting
def card(
icon: str, heading: str, content: str, button_text: str, link: str
) -> rx.Component:
return rx.box(
get_icon(icon, class_name="!justify-start"),
rx.box(
rx.text(heading, class_name="font-md-smbold text-slate-11"),
rx.text(content, class_name="font-small text-slate-9 whitespace-pre"),
class_name="flex flex-col gap-2 mt-4 mb-6",
),
rx.link(
button(button_text, variant="secondary"),
href=link,
is_external=False,
underline="none",
),
class_name="flex flex-col border-slate-4 bg-slate-2 p-8 border rounded-[1.125rem]",
)
def deploy() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.h2(
"Deploy your app fast", class_name="font-x-large gradient-heading"
),
rx.text(
"With our services or self-hosting.",
| from pcweb.constants import DISCORD_URL |
import reflex as rx
from pcweb.components.button import button
from pcweb.components.icons.icons import get_icon
from pcweb.constants import DISCORD_URL
|
def card(
icon: str, heading: str, content: str, button_text: str, link: str
) -> rx.Component:
return rx.box(
get_icon(icon, class_name="!justify-start"),
rx.box(
rx.text(heading, class_name="font-md-smbold text-slate-11"),
rx.text(content, class_name="font-small text-slate-9 whitespace-pre"),
class_name="flex flex-col gap-2 mt-4 mb-6",
),
rx.link(
button(button_text, variant="secondary"),
href=link,
is_external=False,
underline="none",
),
class_name="flex flex-col border-slate-4 bg-slate-2 p-8 border rounded-[1.125rem]",
)
def deploy() -> rx.Component:
return rx.el.section(
rx.box(
rx.el.h2(
"Deploy your app fast", class_name="font-x-large gradient-heading"
),
rx.text(
"With our services or self-hosting.",
class_name="font-base text-slate-9",
| from pcweb.pages.docs import hosting |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.