instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
color_box_size = ["2.25rem", "2.25rem", "2.5rem"] template_page_style = { "padding_top": ["1em", "1em", "2em"], "padding_x": ["auto", "auto", "2em"], } template_content_style = { "padding": "1em", "margin_bottom": "2em", "min_height": "90vh", } link_style = { "color": accent_text_color, ...
max_width = "1480px"
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
template_page_style = { "padding_top": ["1em", "1em", "2em"], "padding_x": ["auto", "auto", "2em"], } template_content_style = { "padding": "1em", "margin_bottom": "2em", "min_height": "90vh", } link_style = { "color": accent_text_color, "text_decoration": "none", **hover_accent_col...
color_box_size = ["2.25rem", "2.25rem", "2.5rem"]
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
template_content_style = { "padding": "1em", "margin_bottom": "2em", "min_height": "90vh", } link_style = { "color": accent_text_color, "text_decoration": "none", **hover_accent_color, } overlapping_button_style = { "background_color": "white", "border_radius": border_radius, } mark...
template_page_style = { "padding_top": ["1em", "1em", "2em"], "padding_x": ["auto", "auto", "2em"], }
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
link_style = { "color": accent_text_color, "text_decoration": "none", **hover_accent_color, } overlapping_button_style = { "background_color": "white", "border_radius": border_radius, } markdown_style = { "code": lambda text: rx.code(text, color_scheme="gray"), "codeblock": lambda text, ...
template_content_style = { "padding": "1em", "margin_bottom": "2em", "min_height": "90vh", }
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
overlapping_button_style = { "background_color": "white", "border_radius": border_radius, } markdown_style = { "code": lambda text: rx.code(text, color_scheme="gray"), "codeblock": lambda text, **props: rx.code_block(text, **props, margin_y="1em"), "a": lambda text, **props: rx.link( text...
link_style = { "color": accent_text_color, "text_decoration": "none", **hover_accent_color, }
"""Styles for the app.""" import reflex as rx border_radius = "var(--radius-2)" border = f"1px solid {rx.color('gray', 5)}" text_color = rx.color("gray", 11) gray_color = rx.color("gray", 11) gray_bg_color = rx.color("gray", 3) accent_text_color = rx.color("accent", 10) accent_color = rx.color("accent", 1) accent_bg_...
markdown_style = { "code": lambda text: rx.code(text, color_scheme="gray"), "codeblock": lambda text, **props: rx.code_block(text, **props, margin_y="1em"), "a": lambda text, **props: rx.link( text, **props, font_weight="bold", text_decoration="underline", text_deco...
overlapping_button_style = { "background_color": "white", "border_radius": border_radius, }
er_accent_bg = {"_hover": {"background_color": accent_color}} content_width_vw = "90vw" sidebar_width = "32em" sidebar_content_width = "16em" max_width = "1480px" color_box_size = ["2.25rem", "2.25rem", "2.5rem"] template_page_style = { "padding_top": ["1em", "1em", "2em"], "padding_x": ["auto", "auto", "2em"...
ghost_input_style = { "--text-field-selection-color": "", "--text-field-focus-color": "transparent", "--text-field-border-width": "1px", "background_clip": "content-box", "background_color": "transparent", "box_shadow": "inset 0 0 0 var(--text-field-border-width) transparent", "color": "",...
notification_badge_style = { "width": "1.25rem", "height": "1.25rem", "display": "flex", "align_items": "center", "justify_content": "center", "position": "absolute", "right": "-0.35rem", "top": "-0.35rem", }
= { "background_color": "white", "border_radius": border_radius, } markdown_style = { "code": lambda text: rx.code(text, color_scheme="gray"), "codeblock": lambda text, **props: rx.code_block(text, **props, margin_y="1em"), "a": lambda text, **props: rx.link( text, **props, ...
color_picker_style = { "border_radius": "max(var(--radius-3), var(--radius-full))", "box_shadow": box_shadow_style, "cursor": "pointer", "display": "flex", "align_items": "center", "justify_content": "center", "transition": "transform 0.15s ease-in-out", "_active": { "transform...
box_shadow_style = "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"
n_badge_style = { "width": "1.25rem", "height": "1.25rem", "display": "flex", "align_items": "center", "justify_content": "center", "position": "absolute", "right": "-0.35rem", "top": "-0.35rem", } ghost_input_style = { "--text-field-selection-color": "", "--text-field-focus-col...
base_style = { "font_family": "Inter", }
base_stylesheets = [ "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap", "styles.css", ]
ntent": "center", "position": "absolute", "right": "-0.35rem", "top": "-0.35rem", } ghost_input_style = { "--text-field-selection-color": "", "--text-field-focus-color": "transparent", "--text-field-border-width": "1px", "background_clip": "content-box", "background_color": "transparent...
base_style = { "font_family": "Inter", }
import csv
from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_value: str = "" sort_reverse: bool ...
from pathlib import Path
import csv from pathlib import Path
import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_value: str = "" sort_reverse: bool = False total_items...
from typing import List
import csv from pathlib import Path from typing import List
class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_value: str = "" sort_reverse: bool = False total_items: int = 0 offset:...
import reflex as rx
import csv from pathlib import Path from typing import List import reflex as rx
class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_value: str = "" sort_reverse: bool = False total_items: int = 0 offset: int = 0 limit: int = 12 # Number of rows per page @rx.event def set_search_value(self, value: str)...
class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
@rx.event def set_sort_value(self, value: str): self.sort_value = value @rx.var(cache=True) def filtered_sorted_items(self) -> List[Item]: items = self.items # Filter items based on selected item if self.sort_value: if self.sort_value in ["payment"]: ...
def set_search_value(self, value: str): self.search_value = value
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
@rx.event def set_sort_value(self, value: str): self.sort_value = value @rx.var(cache=True) def filtered_sorted_items(self) -> List[Item]: items = self.items # Filter items based on selected item if self.sort_value: if self.sort_value in ["payment"]: ...
self.search_value = value
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
@rx.var(cache=True) def filtered_sorted_items(self) -> List[Item]: items = self.items # Filter items based on selected item if self.sort_value: if self.sort_value in ["payment"]: items = sorted( items, key=lambda item...
def set_sort_value(self, value: str): self.sort_value = value
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
@rx.var(cache=True) def filtered_sorted_items(self) -> List[Item]: items = self.items # Filter items based on selected item if self.sort_value: if self.sort_value in ["payment"]: items = sorted( items, key=lambda item...
self.sort_value = value
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
# Filter items based on selected item if self.sort_value: if self.sort_value in ["payment"]: items = sorted( items, key=lambda item: float(getattr(item, self.sort_value)), reverse=self.sort_reverse, ...
items = self.items
import csv from pathlib import Path from typing import List import reflex as rx class Item(rx.Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_valu...
else: items = sorted( items, key=lambda item: str(getattr(item, self.sort_value)).lower(), reverse=self.sort_reverse, ) # Filter items based on search value if self.search_value: search_...
items = sorted( items, key=lambda item: float(getattr(item, self.sort_value)), reverse=self.sort_reverse, )
Base): """The item class.""" name: str payment: float date: str status: str class TableState(rx.State): """The state class.""" items: List[Item] = [] search_value: str = "" sort_value: str = "" sort_reverse: bool = False total_items: int = 0 offset: int = 0 limi...
# Filter items based on search value if self.search_value: search_value = self.search_value.lower() items = [ item for item in items if any( search_value in str(getattr(item, attr)).lower() ...
items = sorted( items, key=lambda item: str(getattr(item, self.sort_value)).lower(), reverse=self.sort_reverse, )
tems: int = 0 offset: int = 0 limit: int = 12 # Number of rows per page @rx.event def set_search_value(self, value: str): self.search_value = value @rx.event def set_sort_value(self, value: str): self.sort_value = value @rx.var(cache=True) def filtered_sorted_items(se...
items = [ item for item in items if any( search_value in str(getattr(item, attr)).lower() for attr in [ "name", "payment", "date", ...
search_value = self.search_value.lower()
t"]: items = sorted( items, key=lambda item: float(getattr(item, self.sort_value)), reverse=self.sort_reverse, ) else: items = sorted( items, key=lambda item: s...
@rx.var(cache=True) def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.var(cache=True, initial_value=[]) def get_current_page(self) -> list[Item]: start_index = self.offset end_index = s...
def page_number(self) -> int: return (self.offset // self.limit) + 1
(getattr(item, self.sort_value)), reverse=self.sort_reverse, ) else: items = sorted( items, key=lambda item: str(getattr(item, self.sort_value)).lower(), reverse=self.sort_reverse, ...
@rx.var(cache=True, initial_value=[]) def get_current_page(self) -> list[Item]: start_index = self.offset end_index = start_index + self.limit return self.filtered_sorted_items[start_index:end_index] def prev_page(self): if self.page_number > 1: self.offset -= ...
def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 )
key=lambda item: str(getattr(item, self.sort_value)).lower(), reverse=self.sort_reverse, ) # Filter items based on search value if self.search_value: search_value = self.search_value.lower() items = [ item fo...
def prev_page(self): if self.page_number > 1: self.offset -= self.limit def next_page(self): if self.page_number < self.total_pages: self.offset += self.limit def first_page(self): self.offset = 0 def last_page(self): self.offset = (self.total...
def get_current_page(self) -> list[Item]: start_index = self.offset end_index = start_index + self.limit return self.filtered_sorted_items[start_index:end_index]
lue)).lower(), reverse=self.sort_reverse, ) # Filter items based on search value if self.search_value: search_value = self.search_value.lower() items = [ item for item in items if any( ...
end_index = start_index + self.limit return self.filtered_sorted_items[start_index:end_index] def prev_page(self): if self.page_number > 1: self.offset -= self.limit def next_page(self): if self.page_number < self.total_pages: self.offset += self.limit ...
start_index = self.offset
reverse=self.sort_reverse, ) # Filter items based on search value if self.search_value: search_value = self.search_value.lower() items = [ item for item in items if any( search_value in str(geta...
return self.filtered_sorted_items[start_index:end_index] def prev_page(self): if self.page_number > 1: self.offset -= self.limit def next_page(self): if self.page_number < self.total_pages: self.offset += self.limit def first_page(self): self.offse...
end_index = start_index + self.limit
.search_value: search_value = self.search_value.lower() items = [ item for item in items if any( search_value in str(getattr(item, attr)).lower() for attr in [ "name", ...
def next_page(self): if self.page_number < self.total_pages: self.offset += self.limit def first_page(self): self.offset = 0 def last_page(self): self.offset = (self.total_pages - 1) * self.limit def load_entries(self): with Path("items.csv").open(mode="r...
def prev_page(self): if self.page_number > 1: self.offset -= self.limit
arch_value = self.search_value.lower() items = [ item for item in items if any( search_value in str(getattr(item, attr)).lower() for attr in [ "name", "payment", ...
def next_page(self): if self.page_number < self.total_pages: self.offset += self.limit def first_page(self): self.offset = 0 def last_page(self): self.offset = (self.total_pages - 1) * self.limit def load_entries(self): with Path("items.csv").open(mode="r...
if self.page_number > 1: self.offset -= self.limit
for item in items if any( search_value in str(getattr(item, attr)).lower() for attr in [ "name", "payment", "date", "status", ] ) ...
def first_page(self): self.offset = 0 def last_page(self): self.offset = (self.total_pages - 1) * self.limit def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) fo...
if self.page_number < self.total_pages: self.offset += self.limit
getattr(item, attr)).lower() for attr in [ "name", "payment", "date", "status", ] ) ] return items @rx.var(cache=True) def page_number(sel...
def last_page(self): self.offset = (self.total_pages - 1) * self.limit def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) for row in reader] self.total_items = len...
def first_page(self): self.offset = 0
for attr in [ "name", "payment", "date", "status", ] ) ] return items @rx.var(cache=True) def page_number(self) -> int: return (sel...
def last_page(self): self.offset = (self.total_pages - 1) * self.limit def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) for row in reader] self.total_items = len...
self.offset = 0
r attr in [ "name", "payment", "date", "status", ] ) ] return items @rx.var(cache=True) def page_number(self) -> int: return (self.offset // self.limi...
def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) for row in reader] self.total_items = len(self.items) def toggle_sort(self): self.sort_reverse = not self.sort_r...
def last_page(self): self.offset = (self.total_pages - 1) * self.limit
"name", "payment", "date", "status", ] ) ] return items @rx.var(cache=True) def page_number(self) -> int: return (self.offset // self.limit) + 1 @rx.var(cache=Tru...
def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) for row in reader] self.total_items = len(self.items) def toggle_sort(self): self.sort_reverse = not self.sort_r...
self.offset = (self.total_pages - 1) * self.limit
"date", "status", ] ) ] return items @rx.var(cache=True) def page_number(self) -> int: return (self.offset // self.limit) + 1 @rx.var(cache=True) def total_pages(self) -> int: return (se...
def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries()
def load_entries(self): with Path("items.csv").open(mode="r", encoding="utf-8") as file: reader = csv.DictReader(file) self.items = [Item(**row) for row in reader] self.total_items = len(self.items)
] return items @rx.var(cache=True) def page_number(self) -> int: return (self.offset // self.limit) + 1 @rx.var(cache=True) def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.va...
self.items = [Item(**row) for row in reader] self.total_items = len(self.items) def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries()
reader = csv.DictReader(file)
ache=True) def page_number(self) -> int: return (self.offset // self.limit) + 1 @rx.var(cache=True) def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.var(cache=True, initial_value=[]) def ge...
self.total_items = len(self.items) def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries()
self.items = [Item(**row) for row in reader]
rn (self.offset // self.limit) + 1 @rx.var(cache=True) def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.var(cache=True, initial_value=[]) def get_current_page(self) -> list[Item]: start_index =...
def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries()
self.total_items = len(self.items)
@rx.var(cache=True) def total_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.var(cache=True, initial_value=[]) def get_current_page(self) -> list[Item]: start_index = self.offset end_index = start_i...
def toggle_sort(self): self.sort_reverse = not self.sort_reverse self.load_entries()
al_pages(self) -> int: return (self.total_items // self.limit) + ( 1 if self.total_items % self.limit else 1 ) @rx.var(cache=True, initial_value=[]) def get_current_page(self) -> list[Item]: start_index = self.offset end_index = start_index + self.limit retur...
self.load_entries()
self.sort_reverse = not self.sort_reverse
from dashboard import styles def card(*children, **props): return rx.card( *children, box_shadow=styles.box_shadow_style, size="3", width="100%", **props, )
import reflex as rx
"""Navbar component for the app."""
from dashboard import styles def menu_item_icon(icon: str) -> rx.Component: return rx.icon(icon, size=20) def menu_item(text: str, url: str) -> rx.Component: """Menu item. Args: text: The text of the item. url: The URL of the item. Returns: rx.Component: The menu item com...
import reflex as rx
"""Navbar component for the app.""" import reflex as rx
def menu_item_icon(icon: str) -> rx.Component: return rx.icon(icon, size=20) def menu_item(text: str, url: str) -> rx.Component: """Menu item. Args: text: The text of the item. url: The URL of the item. Returns: rx.Component: The menu item component. """ # Whether...
from dashboard import styles
"""Navbar component for the app.""" import reflex as rx from dashboard import styles
def menu_item(text: str, url: str) -> rx.Component: """Menu item. Args: text: The text of the item. url: The URL of the item. Returns: rx.Component: The menu item component. """ # Whether the item is active. active = (rx.State.router.page.path == url.lower()) | ( ...
def menu_item_icon(icon: str) -> rx.Component: return rx.icon(icon, size=20)
"""Navbar component for the app.""" import reflex as rx from dashboard import styles def menu_item_icon(icon: str) -> rx.Component: return rx.icon(icon, size=20) def menu_item(text: str, url: str) -> rx.Component: """Menu item. Args: text: The text of the item. url: The URL of the ite...
return rx.link( rx.hstack( rx.match( text, ("Overview", menu_item_icon("home")), ("Table", menu_item_icon("table-2")), ("About", menu_item_icon("book-open")), ("Profile", menu_item_icon("user")), ("...
active = (rx.State.router.page.path == url.lower()) | ( (rx.State.router.page.path == "/") & text == "Overview" )
align="center", border_radius=styles.border_radius, width="100%", spacing="2", padding="0.35em", ), underline="none", href=url, width="100%", ) def navbar_footer() -> rx.Component: """Navbar footer. Returns: ...
ordered_page_routes = [ "/", "/table", "/about", "/profile", "/settings", ] pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ] ordered_pages = sorted( pages, key=lambda page...
from reflex.page import DECORATED_PAGES
r_radius=styles.border_radius, width="100%", spacing="2", padding="0.35em", ), underline="none", href=url, width="100%", ) def navbar_footer() -> rx.Component: """Navbar footer. Returns: The navbar footer component. """ ...
pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ] ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else...
ordered_page_routes = [ "/", "/table", "/about", "/profile", "/settings", ]
underline="none", href=url, width="100%", ) def navbar_footer() -> rx.Component: """Navbar footer. Returns: The navbar footer component. """ return rx.hstack( rx.link( rx.text("Docs", size="3"), href="https://reflex.dev/docs/getting-s...
ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else len(ordered_page_routes) ), ) return rx.drawer.root( rx.drawer.trigger( rx.icon("align-ju...
pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ]
er. Returns: The navbar footer component. """ return rx.hstack( rx.link( rx.text("Docs", size="3"), href="https://reflex.dev/docs/getting-started/introduction/", color_scheme="gray", underline="none", ), rx.link( r...
return rx.drawer.root( rx.drawer.trigger( rx.icon("align-justify"), ), rx.drawer.overlay(z_index="5"), rx.drawer.portal( rx.drawer.content( rx.vstack( rx.hstack( rx.spacer(), ...
ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else len(ordered_page_routes) ), )
from reflex.components.radix.themes.base import ( LiteralAccentColor, ) from dashboard import styles def notification(icon: str, color: LiteralAccentColor, count: int) -> rx.Component: return rx.box( rx.icon_button( rx.icon(icon), padding="0.5rem", radius="full", ...
import reflex as rx
import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, )
def notification(icon: str, color: LiteralAccentColor, count: int) -> rx.Component: return rx.box( rx.icon_button( rx.icon(icon), padding="0.5rem", radius="full", variant="soft", color_scheme=color, size="3", ), rx.ba...
from dashboard import styles
def profile_input( label: str, name: str, placeholder: str, type: str, icon: str, default_value: str = "", ) -> rx.Component: return rx.vstack( rx.hstack( rx.icon(icon, size=16, stroke_width=1.5), rx.text(label), width="100%", align=...
import reflex as rx
"""Sidebar component for the app."""
from .. import styles def sidebar_header() -> rx.Component: """Sidebar header. Returns: The sidebar header component. """ return rx.hstack( # The logo. rx.color_mode_cond( rx.image(src="/reflex_black.svg", height="1.5em"), rx.image(src="/reflex_white...
import reflex as rx
"""Sidebar component for the app.""" import reflex as rx
def sidebar_header() -> rx.Component: """Sidebar header. Returns: The sidebar header component. """ return rx.hstack( # The logo. rx.color_mode_cond( rx.image(src="/reflex_black.svg", height="1.5em"), rx.image(src="/reflex_white.svg", height="1.5em"),...
from .. import styles
"""Sidebar component for the app.""" import reflex as rx from .. import styles
def sidebar_footer() -> rx.Component: """Sidebar footer. Returns: The sidebar footer component. """ return rx.hstack( rx.link( rx.text("Docs", size="3"), href="https://reflex.dev/docs/getting-started/introduction/", color_scheme="gray", ...
def sidebar_header() -> rx.Component: """Sidebar header. Returns: The sidebar header component. """ return rx.hstack( # The logo. rx.color_mode_cond( rx.image(src="/reflex_black.svg", height="1.5em"), rx.image(src="/reflex_white.svg", height="1.5em"), ...
mode_cond( rx.image(src="/reflex_black.svg", height="1.5em"), rx.image(src="/reflex_white.svg", height="1.5em"), ), rx.spacer(), align="center", width="100%", padding="0.35em", margin_bottom="1em", ) def sidebar_footer() -> rx.Component: ...
def sidebar_item(text: str, url: str) -> rx.Component: """Sidebar item. Args: text: The text of the item. url: The URL of the item. Returns: rx.Component: The sidebar item component. """ # Whether the item is active. active = (rx.State.router.page.path == url.lower(...
def sidebar_item_icon(icon: str) -> rx.Component: return rx.icon(icon, size=18)
The sidebar footer component. """ return rx.hstack( rx.link( rx.text("Docs", size="3"), href="https://reflex.dev/docs/getting-started/introduction/", color_scheme="gray", underline="none", ), rx.link( rx.text("Blog", siz...
return rx.link( rx.hstack( rx.match( text, ("Overview", sidebar_item_icon("home")), ("Table", sidebar_item_icon("table-2")), ("About", sidebar_item_icon("book-open")), ("Profile", sidebar_item_icon("user")), ...
active = (rx.State.router.page.path == url.lower()) | ( (rx.State.router.page.path == "/") & text == "Overview" )
), style={ "_hover": { "background_color": rx.cond( active, styles.accent_bg_color, styles.gray_bg_color, ), "color": rx.cond( ...
ordered_page_routes = [ "/", "/table", "/about", "/profile", "/settings", ] pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ] ordered_pages = sorted( pages, key=lambda page...
from reflex.page import DECORATED_PAGES
"_hover": { "background_color": rx.cond( active, styles.accent_bg_color, styles.gray_bg_color, ), "color": rx.cond( active, styles.accent...
pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ] ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else...
ordered_page_routes = [ "/", "/table", "/about", "/profile", "/settings", ]
s.accent_bg_color, styles.gray_bg_color, ), "color": rx.cond( active, styles.accent_text_color, styles.text_color, ), "opacity": "1", ...
ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else len(ordered_page_routes) ), ) return rx.flex( rx.vstack( sidebar_header(), rx...
pages = [ page_dict for page_list in DECORATED_PAGES.values() for _, page_dict in page_list ]
active, styles.accent_text_color, styles.text_color, ), "opacity": "1", }, "opacity": rx.cond( active, "1", "0.95", ...
return rx.flex( rx.vstack( sidebar_header(), rx.vstack( *[ sidebar_item( text=page.get("title", page["route"].strip("/").capitalize()), url=page["route"], ) f...
ordered_pages = sorted( pages, key=lambda page: ( ordered_page_routes.index(page["route"]) if page["route"] in ordered_page_routes else len(ordered_page_routes) ), )
def _badge(status: str): badge_mapping = { "Completed": ("check", "Completed", "green"), "Pending": ("loader", "Pending", "yellow"), "Canceled": ("ban", "Canceled", "red"), } icon, text, color_scheme = badge_mapping.get( status, ("loader", "Pending", "yellow") ) re...
import reflex as rx
"""The about page."""
import reflex as rx from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read...
from pathlib import Path
"""The about page.""" from pathlib import Path
from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.mark...
import reflex as rx
"""The about page.""" from pathlib import Path import reflex as rx
from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.markdown(content, component...
from .. import styles
"""The about page.""" from pathlib import Path import reflex as rx from .. import styles
@template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.markdown(content, component_map=styles.markdown_style)
from ..templates import template
"""The about page.""" from pathlib import Path import reflex as rx from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="u...
return rx.markdown(content, component_map=styles.markdown_style)
content = readme.read()
"""The overview page of the app."""
import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_...
import datetime
"""The overview page of the app.""" import datetime
from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_...
import reflex as rx
"""The overview page of the app.""" import datetime import reflex as rx
from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart...
from .. import styles
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles
from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart, ) from ..views.stats_cards import...
from ..components.card import card
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card
from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart, ) from ..views.stats_cards import stats_cards from .profile import ProfileState de...
from ..components.notification import notification
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification
from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart, ) from ..views.stats_cards import stats_cards from .profile import ProfileState def _time_data() -> rx.Component: ...
from ..templates import template
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template
from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart, ) from ..views.stats_cards import stats_cards from .profile import ProfileState def _time_data() -> rx.Component: return rx.hstack( rx.tooltip( ...
from ..views.acquisition_view import acquisition
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition
from ..views.stats_cards import stats_cards from .profile import ProfileState def _time_data() -> rx.Component: return rx.hstack( rx.tooltip( rx.icon("info", size=20), content=f"{(datetime.datetime.now() - datetime.timedelta(days=30)).strftime('%b %d, %Y')} - {datetime.datetime.no...
from ..views.charts import ( StatsState, area_toggle, orders_chart, pie_chart, revenue_chart, timeframe_select, users_chart, )
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_t...
from .profile import ProfileState def _time_data() -> rx.Component: return rx.hstack( rx.tooltip( rx.icon("info", size=20), content=f"{(datetime.datetime.now() - datetime.timedelta(days=30)).strftime('%b %d, %Y')} - {datetime.datetime.now().strftime('%b %d, %Y')}", ), ...
from ..views.stats_cards import stats_cards
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_t...
def _time_data() -> rx.Component: return rx.hstack( rx.tooltip( rx.icon("info", size=20), content=f"{(datetime.datetime.now() - datetime.timedelta(days=30)).strftime('%b %d, %Y')} - {datetime.datetime.now().strftime('%b %d, %Y')}", ), rx.text("Last 30 days", size="...
from .profile import ProfileState
"""The overview page of the app.""" import datetime import reflex as rx from .. import styles from ..components.card import card from ..components.notification import notification from ..templates import template from ..views.acquisition_view import acquisition from ..views.charts import ( StatsState, area_t...
@template(route="/", title="Overview", on_load=StatsState.randomize_data) def index() -> rx.Component: """The overview page. Returns: The UI for the overview page. """ return rx.vstack( rx.heading(f"Welcome, {ProfileState.profile.name}", size="5"), rx.flex( rx.in...
def tab_content_header() -> rx.Component: return rx.hstack( _time_data(), area_toggle(), align="center", width="100%", spacing="4", )
"""The profile page."""
from ..components.profile_input import profile_input from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notifications=True) def handle_submit(self, ...
import reflex as rx
"""The profile page.""" import reflex as rx
from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notifications=True) def handle_submit(self, form_data: dict): self.profile = Profile(**for...
from ..components.profile_input import profile_input
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input
class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notifications=True) def handle_submit(self, form_data: dict): self.profile = Profile(**form_data) return rx.toast.s...
from ..templates import template
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input from ..templates import template
class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notifications=True) def handle_submit(self, form_data: dict): self.profile = Profile(**form_data) return rx.toast.success("Profile updated successfully", position="top-center") def toggle_notifications(self...
class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notif...
def toggle_notifications(self): self.profile.notifications = not self.profile.notifications @template(route="/profile", title="Profile") def profile() -> rx.Component: """The profile page. Returns: The UI for the profile page. """ return rx.vstack( rx.flex( ...
def handle_submit(self, form_data: dict): self.profile = Profile(**form_data) return rx.toast.success("Profile updated successfully", position="top-center")
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notif...
return rx.toast.success("Profile updated successfully", position="top-center") def toggle_notifications(self): self.profile.notifications = not self.profile.notifications @template(route="/profile", title="Profile") def profile() -> rx.Component: """The profile page. Returns: Th...
self.profile = Profile(**form_data)
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notif...
@template(route="/profile", title="Profile") def profile() -> rx.Component: """The profile page. Returns: The UI for the profile page. """ return rx.vstack( rx.flex( rx.vstack( rx.hstack( rx.icon("square-user-round"), ...
def toggle_notifications(self): self.profile.notifications = not self.profile.notifications
"""The profile page.""" import reflex as rx from ..components.profile_input import profile_input from ..templates import template class Profile(rx.Base): name: str = "" email: str = "" notifications: bool = True class ProfileState(rx.State): profile: Profile = Profile(name="Admin", email="", notif...
@template(route="/profile", title="Profile") def profile() -> rx.Component: """The profile page. Returns: The UI for the profile page. """ return rx.vstack( rx.flex( rx.vstack( rx.hstack( rx.icon("square-user-round"), ...
self.profile.notifications = not self.profile.notifications
"""The settings page."""
from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. ...
import reflex as rx
"""The settings page.""" import reflex as rx
from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the...
from ..templates import template
"""The settings page.""" import reflex as rx from ..templates import template
from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", ...
from ..views.color_picker import primary_color_picker, secondary_color_picker
"""The settings page.""" import reflex as rx from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker
from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker ...
from ..views.radius_picker import radius_picker
"""The settings page.""" import reflex as rx from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker
@template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( ...
from ..views.scaling_picker import scaling_picker
"""The table page."""
from ..backend.table_state import TableState from ..templates import template from ..views.table import main_table @template(route="/table", title="Table", on_load=TableState.load_entries) def table() -> rx.Component: """The table page. Returns: The UI for the table page. """ return rx.vst...
import reflex as rx
"""The table page.""" import reflex as rx
from ..templates import template from ..views.table import main_table @template(route="/table", title="Table", on_load=TableState.load_entries) def table() -> rx.Component: """The table page. Returns: The UI for the table page. """ return rx.vstack( rx.heading("Table", size="5"), ...
from ..backend.table_state import TableState
"""The table page.""" import reflex as rx from ..backend.table_state import TableState
from ..views.table import main_table @template(route="/table", title="Table", on_load=TableState.load_entries) def table() -> rx.Component: """The table page. Returns: The UI for the table page. """ return rx.vstack( rx.heading("Table", size="5"), main_table(), spaci...
from ..templates import template
"""The table page.""" import reflex as rx from ..backend.table_state import TableState from ..templates import template
@template(route="/table", title="Table", on_load=TableState.load_entries) def table() -> rx.Component: """The table page. Returns: The UI for the table page. """ return rx.vstack( rx.heading("Table", size="5"), main_table(), spacing="8", width="100%", )
from ..views.table import main_table
"""Common templates used between pages in the app."""
from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] de...
from __future__ import annotations
"""Common templates used between pages in the app.""" from __future__ import annotations
import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href):...
from typing import Callable
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable
from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.i...
import reflex as rx
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx
from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( ...
from .. import styles
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles
from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href,...
from ..components.navbar import navbar