You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/modules/flow-ui/pages/themes/themes.adoc
+51-15Lines changed: 51 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Themes are used to manage the visual presentation of the application.
5
5
6
6
A theme consists of CSS files and other resources like images and fonts.
7
7
8
-
Jmix provides *jmix-lumo* theme built on top of Vaadin https://vaadin.com/docs/latest/styling/lumo[Lumo theme^].
8
+
Jmix provides *jmix-lumo* theme built on top of Vaadin's https://vaadin.com/docs/latest/styling/lumo[Lumo^] theme.
9
9
10
10
[[applying-theme]]
11
11
== Applying a Theme
@@ -35,26 +35,52 @@ NOTE: Themes cannot be switched at runtime. Although a project may have multiple
35
35
[[application-theme]]
36
36
== Application Theme
37
37
38
-
For use in an application, the theme folder is placed inside the `frontend/themes` folder, with a name of your choosing. Jmix application projects created using Studio have a predefined theme folder with the same name as the project itself.
38
+
Themes, available to the application, are located inside the `src/main/frontend/themes` folder. Jmix application projects created using Studio have a predefined theme folder with the same name as the project itself.
* `my-project` - the theme folder, also used as theme name
44
-
* `styles.css` - the master stylesheet
45
-
* `my-project.css` - an entry point for custom styles and imports
46
-
* `theme.json` - a theme configuration file, which by default defines *jmix-lumo* as the default theme.
42
+
[source]
43
+
----
44
+
src
45
+
└── main
46
+
└── frontend
47
+
└── themes
48
+
└── my-project
49
+
├── my-project.css
50
+
├── styles.css
51
+
├── theme.json
52
+
└── view
53
+
├── login-view.css
54
+
├── main-view-top-menu.css
55
+
└── main-view.css
56
+
----
47
57
48
-
`styles.css` is the entry point to the theme's styles. All CSS, including *Lumo* style property values and custom component styles, can be added there.
58
+
* `my-project` - the theme folder. Its name is used as the theme name for the <<applying-theme,@Theme>> annotation.
59
+
* `styles.css` - the main stylesheet, which is the entry point to this project's theme styles.
60
+
* `my-project.css` - a stylesheet for custom styles and imports.
61
+
* `theme.json` - the theme configuration file. By default, it defines *jmix-lumo* as the parent theme.
62
+
* `view` - this folder contains CSS files that define styles for the login and main views provided by the project template.
49
63
50
-
It can be useful to split CSS into multiple files to avoid cluttering the main stylesheet. Additional CSS files are loaded using `@import` directives. By default, the project's master stylesheet contains a single import of `<theme-name>.css` file that defines your styles and any other imports.
64
+
All CSS, including CSS variable values and custom component styles, can be included in the main `styles.css` file. However, by default, this file contains only import directives, with the actual CSS organized into separate files to make it easier to handle:
51
65
52
66
[source,css,indent=0]
53
67
.styles.css
54
68
----
55
-
@import url('./my-project.css');
69
+
@import url('my-project.css');
70
+
@import url('view/main-view.css');
71
+
@import url('view/main-view-top-menu.css');
72
+
@import url('view/login-view.css');
56
73
----
57
74
75
+
Place your project's CSS in the `<theme_name>.css` file (in this example, it's `my-project.css`).
76
+
77
+
[TIP]
78
+
====
79
+
Use Vaadin's online https://demo.vaadin.com/lumo-editor/[Lumo theme editor^] to quickly create a customized theme for your application.
80
+
81
+
To select the desired appearance, use the controls in the right-side panel. Then, click *Download* and insert the provided CSS code, located within the `<style>` tags, into your `<theme_name>.css` file.
82
+
====
83
+
58
84
[[reusable-theme]]
59
85
== Reusable Theme
60
86
@@ -68,11 +94,21 @@ An application theme can be used in multiple applications by packaging it as a J
0 commit comments