-
-
Notifications
You must be signed in to change notification settings - Fork 328
The default title of reactpy is 'ReactPy', how to customize the title? #1069
-
Current Situation
@component def App(): temps_list = read_last10('pi_temp.txt') return html._( html.title("raspberry pi temperature monitor"), html.h1("raspberry"), html.img({ "src": "https://cdn.pixabay.com/photo/2016/11/27/21/42/stock-1863880_1280.jpg", "style": {"width": "10%", "margin_left": "0%"}, }), DataList(temps_list), html.p('cpu load: {}'.format(load_avg)), html.p('uptime: {}'.format(GetTime())), )
Proposed Actions
I tried to check the documentation on the official website but I don't quite understand it.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
This can be done by passing extra options when configuring your application of choice:
from fastapi import FastAPI from reactpy.backend.fastapi import configure, Options from reactpy import html ... app = FastAPI() configure(app, my_component, Options(head=html.head(html.title("My Title"))))
Beta Was this translation helpful? Give feedback.
All reactions
-
Is there another option to do this? Like if I want to set the title once the app is running?
Beta Was this translation helpful? Give feedback.
All reactions
-
At the moment, the best way to change the title during runtime is via JavaScript html.script('document.title = "My Title";')
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 4
-
The documentation for things like this aren't very clear about.
Beta Was this translation helpful? Give feedback.