Skip to content
Discussion options

You must be logged in to vote

ReactPy can include CSS styles but there a number of different ways to do so. The simplest way might be to do the following with html.style:

fromreactpyimporthtml, component, runwithopen("path/to/stylesheet.css") asf: css=f.read() @componentdefapp(): returnhtml.div( html.style(css), ..., ) run(app)

As you app grows you may need to consider splitting up your style sheets into different files. In that case you could serve them from a directory and load them with html.link:

fromfastapiimportFastAPIfromreactpy.backend.fastapiimportconfigureserver=FastAPI() server.mount("/static", StaticFiles(directory="static"), name="static") @componentdef

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Archmonger
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rmorshea
Comment options

Answer selected byrmorshea
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Category
Problem
Labels
None yet
4 participants
@valeriofiorentini@rmorshea@Archmonger@sohaibaumer