Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs update code title #897

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions solara/website/pages/documentation/components/page/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@

@solara.component
def Page():
title, set_title = solara.use_state(cast(Optional[str], "Custom title!"))
with solara.VBox() as main:
solara.ToggleButtonsSingle(value=title, values=[None, "Custom title!", "Different custom title"], on_value=set_title)

if title is not None:
# if the title is not set in a child component, the parent's title will be used
with solara.Head():
# title should always occur inside a Head component
solara.Title(title)
solara.Info(f"Your browser tab title should say {title}", classes=["mt-4"])
else:
solara.Warning("If no title is set, the parent title is used.", classes=["mt-4"])

return main
title = solara.use_reactive(cast(Optional[str], "Custom title!"))

solara.ToggleButtonsSingle(value=title, values=[None, "Custom title!", "Different custom title"])

if title is not None:
# if the title is not set in a child component, the parent's title will be used
with solara.Head():
# title should always occur inside a Head component
solara.Title(title)
solara.Info(f"Your browser tab title should say {title}", classes=["mt-4"])
else:
solara.Warning("If no title is set, the parent title is used.", classes=["mt-4"])


__doc__ += apidoc(solara.Title.f) # type: ignore
Loading