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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 11 additions & 13 deletions solara/website/pages/documentation/components/page/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
@solara.component
def Page():
title, set_title = solara.use_state(cast(Optional[str], "Custom title!"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be replaced with solara.use_reactive

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

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"])


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