Styling React Router Frontend for Python FastAPI Backend with CSS
Arkalos uses vanilla CSS for full control over styling while keeping the setup simple and lightweight. All styles live in the frontend/app/css/ directory and are bundled together via a central _app.css file.
Main Entry Point: "_app.css"
The file frontend/app/css/_app.css acts as the main entry point. It does not contain direct styles but instead assembles all your CSS modules:
@import "_vars";
@import "_core";
@import "link";
@import "form";
@import "button";
@import "label";
@import "loader";
@import "nav";
@import "table";
@import "pagination";
@import "card";
@import "grid";
@import "chart";
@import "metric";
@import "index";
@import "chat/chat";
@import "chat/message";
@import "chat/markdown";
Note
Always import _vars.css and _core.css first, followed by component styles and custom page styles last.
Defining CSS Variables
Use frontend/app/css/_vars.css to define or override global CSS variables:
These variables are then used across all stylesheets:
Global Layout and Typography
The frontend/app/css/_core.css file handles:
- Reset styles (normalize)
- Global typography
- HTML and body layout
Example:
Component-Specific CSS
Each UI component or page section typically has its own CSS file. For example:
form.css— styles for form elementsnav.css— styles for the navigation barcard.css— styles for content cardschat/message.css— styles specific to chat messages
This separation helps you keep styles clean and modular.
Adding New Styles
When creating a new component or page:
- Create a new CSS file inside
frontend/app/css/, e.g.my-widget.css - Define your styles:
- Import the new file at the end of
_app.css:
- Then use it in your component: