├── .gitignore ├── .gitpod.yml ├── .npmrc ├── LICENSE ├── README.md ├── layouts-example.png ├── package-lock.json ├── package.json ├── pom.xml ├── src └── main │ ├── frontend │ ├── index.html │ ├── src │ │ ├── components │ │ │ ├── ex-add-content.js │ │ │ └── ex-card.js │ │ ├── utils.js │ │ └── views │ │ │ ├── centered-content-view.js │ │ │ ├── fixed-nav-sticky-footer-view.js │ │ │ ├── intro-view.js │ │ │ ├── login-form-view.js │ │ │ ├── pricing-view.js │ │ │ ├── three-columns-view.js │ │ │ └── two-columns-view.js │ ├── styles │ │ ├── README │ │ └── checkoutform.css │ └── views │ │ └── README │ ├── java │ └── com │ │ └── vaadin │ │ └── demo │ │ ├── AppNavLayout.java │ │ ├── MainView.java │ │ ├── components │ │ ├── ExAddContent.java │ │ └── ExCard.java │ │ ├── entity │ │ ├── Book.java │ │ └── Product.java │ │ ├── service │ │ └── BookService.java │ │ └── views │ │ ├── BasicAppLayoutView.java │ │ ├── CarouselExampleView.java │ │ ├── CenteredContentView.java │ │ ├── CheckoutFormView.java │ │ ├── FixedNavStickyFooterView.java │ │ ├── HorizontalExamplesView.java │ │ ├── IntroView.java │ │ ├── ListingFormView.java │ │ ├── LoginFormView.java │ │ ├── MarketingView.java │ │ ├── PricingView.java │ │ ├── ThreeColumnsView.java │ │ ├── TwoColumnsView.java │ │ └── VerticalExamplesView.java │ ├── resources │ └── simplelogger.properties │ └── webapp │ ├── icons │ ├── Github.png │ └── icon.png │ └── images │ ├── DataCentricApplicationsWithVaadin.png │ ├── LearningVaadin7.png │ ├── Vaadin 6.png │ ├── Vaadin 6PreviewEdition.png │ ├── Vaadin 7.png │ ├── Vaadin14.png │ ├── Vaadin7Cookbook.png │ ├── Vaadin7UIDesignByExample.png │ ├── VaadinPortletStarter.png │ └── VaadinReceipes.png ├── tsconfig.json └── types.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | build/ 3 | 4 | # IDEA 5 | .idea/ 6 | *.iml 7 | 8 | # MacOS 9 | .DS_Store 10 | 11 | # Eclipse 12 | .settings 13 | .classpath 14 | .project 15 | 16 | # NPM 17 | node_modules 18 | src/main/frontend/generated/ 19 | 20 | bower_components/ 21 | .vscode 22 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - init: mvn package -Pproduction 3 | 4 | command: mvn jetty:run 5 | ports: 6 | - port: 8080 7 | onOpen: open-preview 8 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # 2 | # NOTICE: this is an auto-generated file 3 | # 4 | # This file sets the default parameters for manual `pnpm install`. 5 | # 6 | shamefully-hoist=true 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Layout Examples for Vaadin Flow 2 | 3 | This project is a fully working Vaadin application that you continue developing locally. 4 | It has all the necessary dependencies and files to help you get going. 5 | 6 | [![Vaadin 14 Layout Example](layouts-example.png)](https://labs.vaadin.com/layout-examples/) 7 | 8 | The project is a standard Maven project, so you can import it to your IDE of choice. 9 | 10 | To run from the command line, use `mvn jetty:run` and open [http://localhost:8080](http://localhost:8080) in your browser. 11 | 12 | ## Project structure 13 | 14 | - `MainView.java` in `src/main/java` contains the navigation setup. It uses [App Layout](https://vaadin.com/components/vaadin-app-layout). 15 | - `views` package in `src/main/java` contains the server-side Java views of your application. 16 | - `views` folder in `frontend/src/` contains the client-side JavaScript views of your application. 17 | 18 | ## What next? 19 | 20 | [vaadin.com](https://vaadin.com) has lots of material to help you get you started: 21 | 22 | - Follow the tutorials in [vaadin.com/tutorials](https://vaadin.com/tutorials). Especially [vaadin.com/tutorials/getting-started-with-flow](https://vaadin.com/tutorials/getting-started-with-flow) is good for getting a grasp of the basic Vaadin concepts. 23 | - Read the documentation in [vaadin.com/docs](https://vaadin.com/docs). 24 | - For a bigger Vaadin application example, check out the Full Stack App starter from [vaadin.com/start](https://vaadin.com/start). 25 | -------------------------------------------------------------------------------- /layouts-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/layouts-example.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-name", 3 | "license": "UNLICENSED", 4 | "dependencies": { 5 | "@polymer/polymer": "3.5.2", 6 | "@vaadin/bundles": "24.7.7", 7 | "@vaadin/common-frontend": "0.0.19", 8 | "@vaadin/polymer-legacy-adapter": "24.7.7", 9 | "@vaadin/react-components": "24.7.7", 10 | "@vaadin/react-components-pro": "24.7.7", 11 | "@vaadin/vaadin-development-mode-detector": "2.0.7", 12 | "@vaadin/vaadin-lumo-styles": "24.7.7", 13 | "@vaadin/vaadin-material-styles": "24.7.7", 14 | "@vaadin/vaadin-themable-mixin": "24.7.7", 15 | "@vaadin/vaadin-usage-statistics": "2.1.3", 16 | "@xpertsea/paper-slider": "3.0.0", 17 | "construct-style-sheets-polyfill": "3.1.0", 18 | "date-fns": "2.29.3", 19 | "lit": "3.3.0", 20 | "proj4": "2.15.0", 21 | "react": "18.3.1", 22 | "react-dom": "18.3.1", 23 | "react-router": "7.5.2" 24 | }, 25 | "devDependencies": { 26 | "@babel/preset-react": "7.26.3", 27 | "@preact/signals-react-transform": "0.5.1", 28 | "@rollup/plugin-replace": "6.0.2", 29 | "@rollup/pluginutils": "5.1.4", 30 | "@types/react": "18.3.20", 31 | "@types/react-dom": "18.3.6", 32 | "@vitejs/plugin-react": "4.4.1", 33 | "async": "3.2.6", 34 | "glob": "11.0.2", 35 | "rollup-plugin-brotli": "3.1.0", 36 | "rollup-plugin-visualizer": "5.14.0", 37 | "strip-css-comments": "5.0.0", 38 | "transform-ast": "2.4.4", 39 | "typescript": "5.7.3", 40 | "vite": "6.3.4", 41 | "vite-plugin-checker": "0.9.1", 42 | "workbox-build": "7.3.0", 43 | "workbox-core": "7.3.0", 44 | "workbox-precaching": "7.3.0" 45 | }, 46 | "vaadin": { 47 | "dependencies": { 48 | "@polymer/polymer": "3.5.2", 49 | "@vaadin/bundles": "24.7.7", 50 | "@vaadin/common-frontend": "0.0.19", 51 | "@vaadin/polymer-legacy-adapter": "24.7.7", 52 | "@vaadin/react-components": "24.7.7", 53 | "@vaadin/react-components-pro": "24.7.7", 54 | "@vaadin/vaadin-development-mode-detector": "2.0.7", 55 | "@vaadin/vaadin-lumo-styles": "24.7.7", 56 | "@vaadin/vaadin-material-styles": "24.7.7", 57 | "@vaadin/vaadin-themable-mixin": "24.7.7", 58 | "@vaadin/vaadin-usage-statistics": "2.1.3", 59 | "@xpertsea/paper-slider": "3.0.0", 60 | "construct-style-sheets-polyfill": "3.1.0", 61 | "date-fns": "2.29.3", 62 | "lit": "3.3.0", 63 | "proj4": "2.15.0", 64 | "react": "18.3.1", 65 | "react-dom": "18.3.1", 66 | "react-router": "7.5.2" 67 | }, 68 | "devDependencies": { 69 | "@babel/preset-react": "7.26.3", 70 | "@preact/signals-react-transform": "0.5.1", 71 | "@rollup/plugin-replace": "6.0.2", 72 | "@rollup/pluginutils": "5.1.4", 73 | "@types/react": "18.3.20", 74 | "@types/react-dom": "18.3.6", 75 | "@vitejs/plugin-react": "4.4.1", 76 | "async": "3.2.6", 77 | "glob": "11.0.2", 78 | "rollup-plugin-brotli": "3.1.0", 79 | "rollup-plugin-visualizer": "5.14.0", 80 | "strip-css-comments": "5.0.0", 81 | "transform-ast": "2.4.4", 82 | "typescript": "5.7.3", 83 | "vite": "6.3.4", 84 | "vite-plugin-checker": "0.9.1", 85 | "workbox-build": "7.3.0", 86 | "workbox-core": "7.3.0", 87 | "workbox-precaching": "7.3.0" 88 | }, 89 | "hash": "f95c40fd3113bab2b6318947f511fd283bab04e3de5f774791c8164ea53b3ee7" 90 | }, 91 | "overrides": { 92 | "@vaadin/bundles": "$@vaadin/bundles", 93 | "@vaadin/polymer-legacy-adapter": "$@vaadin/polymer-legacy-adapter", 94 | "@vaadin/vaadin-development-mode-detector": "$@vaadin/vaadin-development-mode-detector", 95 | "@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles", 96 | "@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles", 97 | "@vaadin/vaadin-usage-statistics": "$@vaadin/vaadin-usage-statistics", 98 | "@vaadin/common-frontend": "$@vaadin/common-frontend", 99 | "construct-style-sheets-polyfill": "$construct-style-sheets-polyfill", 100 | "lit": "$lit", 101 | "@polymer/polymer": "$@polymer/polymer", 102 | "proj4": "$proj4", 103 | "@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin", 104 | "date-fns": "$date-fns", 105 | "@xpertsea/paper-slider": "$@xpertsea/paper-slider", 106 | "@vaadin/react-components": "$@vaadin/react-components", 107 | "@vaadin/react-components-pro": "$@vaadin/react-components-pro", 108 | "react-dom": "$react-dom", 109 | "react": "$react", 110 | "react-router": "$react-router" 111 | }, 112 | "type": "module" 113 | } -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.vaadin.demo 4 | layout-examples 5 | layout-examples 6 | 1.0-SNAPSHOT 7 | war 8 | 9 | 10 | 17 11 | 17 12 | UTF-8 13 | UTF-8 14 | false 15 | 16 | 24.7.6 17 | 18 | 19 | 20 | 21 | 22 | Vaadin Directory 23 | https://maven.vaadin.com/vaadin-addons 24 | 25 | 26 | 27 | 28 | 29 | 30 | com.vaadin 31 | vaadin-bom 32 | pom 33 | import 34 | ${vaadin.version} 35 | 36 | 37 | 38 | 39 | 40 | 41 | com.vaadin 42 | 43 | vaadin 44 | 45 | 46 | 47 | 48 | 49 | org.slf4j 50 | slf4j-simple 51 | 52 | 53 | 54 | jakarta.servlet 55 | jakarta.servlet-api 56 | 5.0.0 57 | provided 58 | 59 | 60 | 61 | com.flowingcode.addons.carousel 62 | carousel-addon 63 | 2.0.0 64 | 65 | 66 | 67 | 68 | 69 | jetty:run 70 | 71 | 72 | org.apache.maven.plugins 73 | maven-compiler-plugin 74 | 3.8.0 75 | 76 | 77 | org.apache.maven.plugins 78 | maven-war-plugin 79 | 3.4.0 80 | 81 | 82 | 83 | org.eclipse.jetty.ee10 84 | jetty-ee10-maven-plugin 85 | 12.0.15 86 | 87 | 90 | 2 91 | 92 | 93 | 94 | 99 | 100 | com.vaadin 101 | vaadin-maven-plugin 102 | ${vaadin.version} 103 | 104 | 105 | 106 | prepare-frontend 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | production 118 | 119 | true 120 | 121 | 122 | 123 | 124 | com.vaadin 125 | flow-server-production-mode 126 | 127 | 128 | 129 | 130 | 131 | 132 | com.vaadin 133 | vaadin-maven-plugin 134 | 135 | 136 | 137 | build-frontend 138 | 139 | compile 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/main/frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/frontend/src/components/ex-add-content.js: -------------------------------------------------------------------------------- 1 | import { html, LitElement, css, render } from "lit"; 2 | 3 | import "@vaadin/button/vaadin-button"; 4 | 5 | /** 6 | * `ex-add-content` 7 | * 8 | * Component which includes a button to add more content to the page for 9 | * demonstration purposes e.g. for testing how the layout behaves with more 10 | * content or for more easily making the page scrollable if there is otherwise 11 | * not enough content. 12 | * 13 | * @customElement 14 | * @polymer 15 | */ 16 | class ExAddContent extends LitElement { 17 | render() { 18 | return html` 19 | Add Content 20 | 21 | `; 22 | } 23 | 24 | static get is() { 25 | return "ex-add-content"; 26 | } 27 | 28 | addContent() { 29 | this.__contentTemplate = 30 | this.__contentTemplate || 31 | html` 32 |

33 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi luctus 34 | diam ac posuere pulvinar. Integer ultrices eros quis nisi pharetra, 35 | eget placerat nibh rutrum. Donec magna nisi, sollicitudin non tortor 36 | condimentum, aliquet rutrum risus. Interdum et malesuada fames ac ante 37 | ipsum primis in faucibus. Sed consectetur mauris vel mauris semper 38 | vulputate. Integer viverra ipsum arcu, in vehicula arcu consectetur 39 | ac. Cras at augue et nisl egestas rhoncus sit amet quis neque. Donec 40 | ullamcorper, dui in euismod luctus, massa justo interdum risus, et 41 | luctus lacus sapien at nisi. Mauris non odio mattis, tempor ante eu, 42 | scelerisque neque. Quisque ut lectus finibus, egestas purus quis, 43 | sagittis nunc. 44 |

45 | `; 46 | 47 | render(this.__contentTemplate, this); 48 | } 49 | } 50 | 51 | customElements.define(ExAddContent.is, ExAddContent); 52 | -------------------------------------------------------------------------------- /src/main/frontend/src/components/ex-card.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | /** 5 | * `ex-card` 6 | * 7 | * ExCard example card component. 8 | * 9 | * @customElement 10 | * @polymer 11 | */ 12 | class ExCard extends LitElement { 13 | static get styles() { 14 | const includedStyles = {}; 15 | includedStyles["common-styles"] = 16 | document.querySelector("dom-module[id='common-styles']") 17 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 18 | return [ 19 | unsafeCSS(includedStyles["common-styles"]), 20 | css` 21 | :host { 22 | display: flex; 23 | flex-direction: column; 24 | box-shadow: 0 0 0 1px var(--lumo-contrast-5pct), 25 | var(--lumo-box-shadow-xs); 26 | border-radius: var(--lumo-border-radius-m); 27 | background: var(--lumo-base-color) 28 | linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct)); 29 | } 30 | 31 | header { 32 | background: var(--lumo-shade-5pct); 33 | border-bottom: 1px solid var(--lumo-shade-20pct); 34 | padding: var(--lumo-space-xs); 35 | text-align: center; 36 | font-size: 1.4rem; 37 | } 38 | 39 | main { 40 | padding: var(--excard-padding, var(--lumo-space-m)); 41 | text-align: center; 42 | } 43 | `, 44 | ]; 45 | } 46 | render() { 47 | return html` 48 |
${this.title}
49 |
50 | `; 51 | } 52 | 53 | static get is() { 54 | return "ex-card"; 55 | } 56 | 57 | static get properties() { 58 | return { 59 | title: String, 60 | }; 61 | } 62 | } 63 | 64 | customElements.define(ExCard.is, ExCard); 65 | -------------------------------------------------------------------------------- /src/main/frontend/src/utils.js: -------------------------------------------------------------------------------- 1 | const toggleThemeKeyUpHandler = e => { 2 | if (e.key === 't') { 3 | window.utils.toggleTheme(); 4 | } 5 | }; 6 | 7 | window.utils = window.utils || { 8 | toggleTheme: () => { 9 | const currentTheme = document.documentElement.getAttribute('theme') || document.body.getAttribute('theme'); 10 | const newTheme = currentTheme === 'dark' ? 'light' : 'dark'; 11 | // Set theme on instead of to get background color on full 12 | // height of page when html/body height is automatic. 13 | document.documentElement.setAttribute('theme', newTheme); 14 | document.body.removeAttribute('theme'); 15 | }, 16 | 17 | activateToggleThemeGlobalShortcut: () => { 18 | document.addEventListener('keyup', toggleThemeKeyUpHandler, false); 19 | } 20 | }; 21 | 22 | window.utils.activateToggleThemeGlobalShortcut(); 23 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/centered-content-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | /** 5 | * `centered-content-view` 6 | * 7 | * CenteredContentView element. 8 | * 9 | * @customElement 10 | * @polymer 11 | */ 12 | class CenteredContentView extends LitElement { 13 | static get styles() { 14 | const includedStyles = {}; 15 | includedStyles["common-styles"] = 16 | document.querySelector("dom-module[id='common-styles']") 17 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 18 | return [ 19 | unsafeCSS(includedStyles["common-styles"]), 20 | css` 21 | :host { 22 | display: block; 23 | } 24 | 25 | .wrapper { 26 | margin: 0 auto; 27 | max-width: 960px; 28 | padding: 0 var(--lumo-space-l); 29 | background: var(--lumo-base-color) 30 | linear-gradient( 31 | hsla(349, 100%, 60%, 0.2), 32 | hsla(349, 100%, 60%, 0.2) 33 | ); 34 | } 35 | `, 36 | ]; 37 | } 38 | render() { 39 | return html` 40 |
41 |
42 |
43 | 47 | 48 | View source code 49 | 50 | `; 51 | } 52 | 53 | static get is() { 54 | return "centered-content-view"; 55 | } 56 | } 57 | 58 | customElements.define(CenteredContentView.is, CenteredContentView); 59 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/fixed-nav-sticky-footer-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | import "@vaadin/button/vaadin-button"; 5 | import "../components/ex-card.js"; 6 | 7 | /** 8 | * `fixed-nav-sticky-footer-view` 9 | * 10 | * FixedNavStickyFooterView element. 11 | * 12 | * @customElement 13 | * @polymer 14 | */ 15 | class FixedNavStickyFooterView extends LitElement { 16 | static get styles() { 17 | const includedStyles = {}; 18 | includedStyles["common-styles"] = 19 | document.querySelector("dom-module[id='common-styles']") 20 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 21 | return [ 22 | unsafeCSS(includedStyles["common-styles"]), 23 | css` 24 | :host { 25 | display: flex; 26 | flex-direction: column; 27 | height: 100%; 28 | } 29 | 30 | .wrapper { 31 | margin: 0 auto; /* Horizontally center the layout grid if there is space around it */ 32 | max-width: 960px; 33 | padding: 0 var(--lumo-space-m); 34 | } 35 | 36 | #header { 37 | z-index: 1; 38 | position: fixed; 39 | right: 0; 40 | left: 0; 41 | display: flex; 42 | white-space: nowrap; 43 | flex-wrap: wrap; 44 | align-items: center; 45 | padding: 0 var(--lumo-space-s); 46 | --lumo-primary-text-color: var(--lumo-contrast-90pct); 47 | } 48 | 49 | .searchField { 50 | padding: var(--lumo-space-s) 0; 51 | margin-right: var(--lumo-space-s); 52 | } 53 | 54 | #header a { 55 | display: inline-block; 56 | margin: var(--lumo-space-s); 57 | } 58 | 59 | #header .titleLink { 60 | font-size: var(--lumo-font-size-xl); 61 | margin-right: var(--lumo-space-m); 62 | } 63 | 64 | main { 65 | flex-shrink: 0; 66 | } 67 | 68 | #main { 69 | margin-top: 100px; 70 | } 71 | 72 | footer { 73 | margin-top: auto; 74 | background-color: var(--lumo-shade-10pct); 75 | padding: var(--lumo-space-wide-m); 76 | } 77 | `, 78 | ]; 79 | } 80 | render() { 81 | return html` 82 | 83 |
84 |
85 |
86 | 89 | 93 | 94 | View source code 95 | 96 | `; 97 | } 98 | 99 | static get is() { 100 | return "fixed-nav-sticky-footer-view"; 101 | } 102 | } 103 | 104 | customElements.define(FixedNavStickyFooterView.is, FixedNavStickyFooterView); 105 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/intro-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | import "@vaadin/button/vaadin-button"; 5 | import "../components/ex-card.js"; 6 | 7 | /** 8 | * `intro-view` 9 | * 10 | * IntroView element. 11 | * 12 | * @customElement 13 | * @polymer 14 | */ 15 | class IntroView extends LitElement { 16 | static get styles() { 17 | const includedStyles = {}; 18 | includedStyles["common-styles"] = 19 | document.querySelector("dom-module[id='common-styles']") 20 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 21 | return [ 22 | unsafeCSS(includedStyles["common-styles"]), 23 | css` 24 | :host { 25 | display: block; 26 | } 27 | 28 | main { 29 | margin: 0 auto; 30 | max-width: 960px; 31 | padding: 0 var(--lumo-space-m); 32 | } 33 | 34 | kbd { 35 | font-family: var(--lumo-font-family); 36 | display: inline-block; 37 | background: var(--lumo-contrast-10pct); 38 | padding: var(--lumo-space-wide-xs); 39 | margin: 0 var(--lumo-space-wide-xs); 40 | border-radius: var(--lumo-border-radius-s); 41 | box-shadow: 0 0 0 1px var(--lumo-contrast-10pct), 42 | var(--lumo-box-shadow-xs); 43 | font-size: var(--lumo-font-size-m); 44 | } 45 | 46 | .card-list { 47 | display: flex; 48 | margin: var(--lumo-space-xl) calc(var(--lumo-space-m) * -1); 49 | flex-wrap: wrap; 50 | } 51 | 52 | .card-list > ex-card { 53 | flex: 1 0 210px; 54 | margin: var(--lumo-space-s); 55 | --excard-padding: var(--lumo-space-wide-m); 56 | } 57 | `, 58 | ]; 59 | } 60 | render() { 61 | return html` 62 |
63 |

Layout Examples for Vaadin 14

64 | 65 |

66 | All of the examples are viewable with two themes (light and dark). 67 | Toggle between the themes by clicking the button below or by pressing 68 | T on your keyboard. 69 |

70 |

71 | Toggle Theme 74 |

75 | 76 |

Basic examples

77 |

78 | Examples showcasing individual building blocks or specific features 79 | for creating layouts. Note that the examples marked with "CSS Grid" 80 | are implemented using 81 | CSS Grid Layout 85 | which is a very flexible way to create layouts but notably doesn't 86 | work in IE 11, Safari 9 or older browsers. 87 |

88 |
89 | 90 | Horizontal Layouts 91 |

Simple examples using a HorizontalLayout

92 |
93 | 94 | Vertical Layouts 95 |

Simple examples using a VerticalLayout

96 |
97 |
98 | 99 |
100 | 101 | Three Columns (CSS Grid) 104 |

A grid layout with header, footer and two sidebars

105 |
106 | 107 | Two Columns (CSS Grid) 110 |

A grid layout with header, footer and one sidebar

111 |
112 | 113 | Centered Content 116 |

A horizontally centered container with a maximum width

117 |
118 |
119 | 120 |

Complete layout examples

121 |

122 | Styled ready to use layouts which you may use as is or customize to 123 | your liking. 124 |

125 |
126 | 127 | Pricing 128 |

Pricing page

129 |
130 | 131 | Fixed Nav & Sticky Footer 134 |

135 | Navigation bar fixed to the top of the viewport. Footer at the 136 | bottom of the viewport will get pushed down if there is more 137 | content than fits the viewport. 138 |

139 |
140 | 141 | Basic App Layout 144 |

145 | A basic example of using 146 | AppLayout 149 |

150 |
151 | 152 | Login Form 153 |

A centered login form

154 |
155 | 156 | Checkout form 157 |

158 | A checkout form including a billing address and summary of 159 | shopping card 160 |

161 |
162 | 163 | Marketing page 164 |

165 | Typical web page including a main part and three responsive 166 | article cards under it. 167 |

168 |
169 | 170 | Carousel 171 |

A carousel example

172 |
173 | 174 | Listing form 175 |

Searching and filtering products

176 |
177 |
178 |
179 | `; 180 | } 181 | 182 | static get is() { 183 | return "intro-view"; 184 | } 185 | 186 | toggleTheme() { 187 | window.utils.toggleTheme(); 188 | } 189 | } 190 | 191 | customElements.define(IntroView.is, IntroView); 192 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/login-form-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | import "@vaadin/button/vaadin-button"; 5 | import "@vaadin/password-field/vaadin-password-field"; 6 | import "@vaadin/text-field/vaadin-text-field"; 7 | 8 | /** 9 | * `login-form-view` 10 | * 11 | * LoginFormView element. 12 | * 13 | * @customElement 14 | * @polymer 15 | */ 16 | class LoginFormView extends LitElement { 17 | static get styles() { 18 | const includedStyles = {}; 19 | includedStyles["common-styles"] = 20 | document.querySelector("dom-module[id='common-styles']") 21 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 22 | return [ 23 | unsafeCSS(includedStyles["common-styles"]), 24 | css` 25 | :host { 26 | display: block; 27 | } 28 | 29 | .wrapper { 30 | margin: 0 auto; 31 | max-width: 400px; 32 | padding: var(--lumo-space-xl) var(--lumo-space-l) 0; 33 | } 34 | 35 | .card { 36 | box-shadow: 0 0 0 1px var(--lumo-contrast-5pct), 37 | var(--lumo-box-shadow-s); 38 | border-radius: var(--lumo-border-radius-m); 39 | background: var(--lumo-base-color) 40 | linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct)); 41 | padding: var(--lumo-space-m); 42 | 43 | display: flex; 44 | flex-direction: column; 45 | } 46 | 47 | h3 { 48 | margin-top: var(--lumo-space-s); 49 | } 50 | 51 | .card vaadin-button { 52 | margin: var(--lumo-space-m) 0; 53 | } 54 | 55 | #forgotPasswordButton { 56 | margin: 0; 57 | } 58 | `, 59 | ]; 60 | } 61 | render() { 62 | return html` 63 |
64 |
65 |

Log in

66 | 72 | 78 | Log in 79 | Forgot password 82 |
83 | 87 | 88 | View source code 89 | 90 |
91 | `; 92 | } 93 | 94 | static get is() { 95 | return "login-form-view"; 96 | } 97 | } 98 | 99 | customElements.define(LoginFormView.is, LoginFormView); 100 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/pricing-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | import "../components/ex-card.js"; 5 | 6 | /** 7 | * `pricing-view` 8 | * 9 | * PricingView element. 10 | * 11 | * @customElement 12 | * @polymer 13 | */ 14 | class PricingView extends LitElement { 15 | static get styles() { 16 | const includedStyles = {}; 17 | includedStyles["common-styles"] = 18 | document.querySelector("dom-module[id='common-styles']") 19 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 20 | return [ 21 | unsafeCSS(includedStyles["common-styles"]), 22 | css` 23 | :host { 24 | display: block; 25 | } 26 | 27 | .wrapper { 28 | margin: 0 auto; /* Horizontally center the layout grid if there is space around it */ 29 | max-width: 960px; 30 | padding: 0 var(--lumo-space-m); 31 | } 32 | 33 | #header { 34 | padding: var(--lumo-space-wide-l); 35 | margin-bottom: var(--lumo-space-xl); 36 | box-shadow: 0 0 0 1px var(--lumo-contrast-5pct), 37 | var(--lumo-box-shadow-xs); 38 | } 39 | 40 | #header h2 { 41 | font-size: 1.4rem; 42 | margin: 0; 43 | } 44 | 45 | @media screen and (max-width: 759px) { 46 | #header { 47 | text-align: center; 48 | } 49 | 50 | #header vaadin-menu-bar { 51 | display: inline-block; 52 | max-width: 100%; 53 | } 54 | } 55 | 56 | @media screen and (min-width: 760px) { 57 | #header { 58 | display: flex; 59 | align-items: baseline; 60 | } 61 | 62 | #header h2 { 63 | flex: 1; 64 | } 65 | } 66 | 67 | .card-list { 68 | display: flex; 69 | margin: var(--lumo-space-xl) calc(var(--lumo-space-m) * -1); 70 | flex-wrap: wrap; 71 | } 72 | 73 | .card-list > ex-card { 74 | flex: 1 0 210px; 75 | margin: var(--lumo-space-m); 76 | } 77 | 78 | ex-card ul, 79 | #footer ul { 80 | padding: 0; 81 | } 82 | 83 | ex-card li, 84 | #footer li { 85 | list-style: none; 86 | } 87 | 88 | ex-card vaadin-button { 89 | width: 100%; 90 | font-size: var(--lumo-font-size-l); 91 | --lumo-button-size: 2.4em; 92 | } 93 | 94 | .hero { 95 | margin: 0 auto; 96 | max-width: 700px; 97 | text-align: center; 98 | } 99 | 100 | .hero p { 101 | font-size: var(--lumo-font-size-l); 102 | } 103 | 104 | #footer { 105 | margin-top: var(--lumo-space-xl); 106 | border-top: 1px solid var(--lumo-contrast-30pct); 107 | padding-top: var(--lumo-space-xl); 108 | padding-bottom: var(--lumo-space-l); 109 | display: flex; 110 | flex-wrap: wrap; 111 | --lumo-primary-text-color: var(--lumo-contrast-70pct); 112 | } 113 | 114 | #footer > div { 115 | flex: 1 0 20%; 116 | } 117 | 118 | #footer h2 { 119 | font-size: var(--lumo-font-size-l); 120 | } 121 | 122 | #footer ul { 123 | margin: var(--lumo-space-s) 0; 124 | } 125 | 126 | .copyright { 127 | font-size: var(--lumo-font-size-s); 128 | color: var(--lumo-contrast-60pct); 129 | } 130 | 131 | .copyright-box > [icon] { 132 | color: #00b4f0; 133 | } 134 | 135 | @media screen and (max-width: 789px) { 136 | #footer .copyright-box { 137 | flex-basis: 100%; 138 | } 139 | 140 | #footer > div { 141 | flex: 1 0 45%; 142 | } 143 | } 144 | `, 145 | ]; 146 | } 147 | render() { 148 | return html` 149 | 150 |
151 |
152 | 153 |
154 | 158 | 159 | View source code 160 | 161 | `; 162 | } 163 | 164 | static get is() { 165 | return "pricing-view"; 166 | } 167 | } 168 | 169 | customElements.define(PricingView.is, PricingView); 170 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/three-columns-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | /** 5 | * `three-columns-view` 6 | * 7 | * ThreeColumnsView element. 8 | * 9 | * @customElement 10 | * @polymer 11 | */ 12 | class ThreeColumnsView extends LitElement { 13 | static get styles() { 14 | const includedStyles = {}; 15 | includedStyles["common-styles"] = 16 | document.querySelector("dom-module[id='common-styles']") 17 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 18 | return [ 19 | unsafeCSS(includedStyles["common-styles"]), 20 | css` 21 | :host { 22 | display: block; 23 | } 24 | 25 | .wrapper { 26 | margin: 0 auto; /* Horizontally center the layout grid if there is space around it */ 27 | } 28 | 29 | #sidebarLeft { 30 | grid-area: nav; 31 | background: var(--lumo-base-color) 32 | linear-gradient( 33 | hsla(125, 100%, 60%, 0.2), 34 | hsla(125, 100%, 60%, 0.2) 35 | ); 36 | } 37 | 38 | #header { 39 | grid-area: header; 40 | background: var(--lumo-base-color) 41 | linear-gradient( 42 | hsla(349, 100%, 60%, 0.2), 43 | hsla(349, 100%, 60%, 0.2) 44 | ); 45 | } 46 | 47 | #sidebarRight { 48 | grid-area: aside; 49 | background: var(--lumo-base-color) 50 | linear-gradient(hsla(44, 100%, 60%, 0.2), hsla(44, 100%, 60%, 0.2)); 51 | } 52 | 53 | #main { 54 | grid-area: content; 55 | background: var(--lumo-base-color) 56 | linear-gradient( 57 | hsla(227, 100%, 60%, 0.2), 58 | hsla(227, 100%, 60%, 0.2) 59 | ); 60 | } 61 | 62 | #footer { 63 | grid-area: footer; 64 | background-color: lightcoral; 65 | background: var(--lumo-base-color) 66 | linear-gradient( 67 | hsla(318, 100%, 60%, 0.2), 68 | hsla(318, 100%, 60%, 0.2) 69 | ); 70 | } 71 | 72 | @media only screen and (max-width: 699px) { 73 | .wrapper { 74 | display: grid; 75 | width: 90%; 76 | grid-template-columns: auto; 77 | grid-template-rows: auto; 78 | grid-template-areas: 79 | "nav" 80 | "header" 81 | "content" 82 | "aside" 83 | "footer"; 84 | } 85 | } 86 | 87 | @media only screen and (min-width: 700px) and (max-width: 979px) { 88 | .wrapper { 89 | display: grid; 90 | width: 90%; 91 | grid-template-columns: 20% 5% auto; 92 | grid-template-rows: auto; 93 | grid-template-areas: 94 | "header header header" 95 | "nav . content" 96 | "aside . content" 97 | "footer footer footer"; 98 | } 99 | } 100 | 101 | @media only screen and (min-width: 980px) { 102 | .wrapper { 103 | display: grid; 104 | grid-template-columns: 200px 40px auto 40px 200px; 105 | grid-template-rows: auto; 106 | grid-template-areas: 107 | "header header header header header" 108 | "nav . content . aside" 109 | "footer footer footer footer footer"; 110 | max-width: 1100px; 111 | } 112 | } 113 | `, 114 | ]; 115 | } 116 | render() { 117 | return html` 118 |
119 |
120 | 121 |
122 |
123 | 124 |
125 | 129 | 130 | View source code 131 | 132 | `; 133 | } 134 | 135 | static get is() { 136 | return "three-columns-view"; 137 | } 138 | } 139 | 140 | customElements.define(ThreeColumnsView.is, ThreeColumnsView); 141 | -------------------------------------------------------------------------------- /src/main/frontend/src/views/two-columns-view.js: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from "lit"; 2 | import { html, LitElement, css } from "lit"; 3 | 4 | /** 5 | * `two-columns-view` 6 | * 7 | * TwoColumnsView element. 8 | * 9 | * @customElement 10 | * @polymer 11 | */ 12 | class TwoColumnsView extends LitElement { 13 | static get styles() { 14 | const includedStyles = {}; 15 | includedStyles["common-styles"] = 16 | document.querySelector("dom-module[id='common-styles']") 17 | ?.firstElementChild?.content?.firstElementChild?.innerText ?? ""; 18 | return [ 19 | unsafeCSS(includedStyles["common-styles"]), 20 | css` 21 | :host { 22 | display: block; 23 | } 24 | 25 | .wrapper { 26 | margin: 0 auto; /* Horizontally center the layout grid if there is space around it */ 27 | } 28 | 29 | #sidebar { 30 | grid-area: nav; 31 | background: var(--lumo-base-color) 32 | linear-gradient( 33 | hsla(125, 100%, 60%, 0.2), 34 | hsla(125, 100%, 60%, 0.2) 35 | ); 36 | } 37 | 38 | #header { 39 | grid-area: header; 40 | background: var(--lumo-base-color) 41 | linear-gradient( 42 | hsla(349, 100%, 60%, 0.2), 43 | hsla(349, 100%, 60%, 0.2) 44 | ); 45 | } 46 | 47 | #main { 48 | grid-area: content; 49 | background: var(--lumo-base-color) 50 | linear-gradient( 51 | hsla(227, 100%, 60%, 0.2), 52 | hsla(227, 100%, 60%, 0.2) 53 | ); 54 | } 55 | 56 | #footer { 57 | grid-area: footer; 58 | background-color: lightcoral; 59 | background: var(--lumo-base-color) 60 | linear-gradient( 61 | hsla(318, 100%, 60%, 0.2), 62 | hsla(318, 100%, 60%, 0.2) 63 | ); 64 | } 65 | 66 | @media only screen and (max-width: 699px) { 67 | .wrapper { 68 | display: grid; 69 | width: 90%; 70 | grid-template-columns: auto; 71 | grid-template-rows: auto; 72 | grid-template-areas: 73 | "nav" 74 | "header" 75 | "content" 76 | "footer"; 77 | } 78 | } 79 | 80 | @media only screen and (min-width: 700px) and (max-width: 979px) { 81 | .wrapper { 82 | display: grid; 83 | width: 90%; 84 | grid-template-columns: 20% 5% auto; 85 | grid-template-rows: auto; 86 | grid-template-areas: 87 | "header header header" 88 | "nav . content" 89 | "footer footer footer"; 90 | } 91 | } 92 | 93 | @media only screen and (min-width: 980px) { 94 | .wrapper { 95 | display: grid; 96 | grid-template-columns: 200px 40px auto; 97 | grid-template-rows: auto; 98 | grid-template-areas: 99 | "header header header" 100 | "nav . content" 101 | "footer footer footer"; 102 | max-width: 1100px; 103 | } 104 | } 105 | `, 106 | ]; 107 | } 108 | render() { 109 | return html` 110 |
111 | 112 | 113 |
114 | 115 |
116 | 120 | 121 | View source code 122 | 123 | `; 124 | } 125 | 126 | static get is() { 127 | return "two-columns-view"; 128 | } 129 | } 130 | 131 | customElements.define(TwoColumnsView.is, TwoColumnsView); 132 | -------------------------------------------------------------------------------- /src/main/frontend/styles/README: -------------------------------------------------------------------------------- 1 | Place your optional styles in this folder. 2 | 3 | See https://vaadin.com/docs/flow/theme/theming-overview.html for getting started on theming Vaadin Flow applications. 4 | -------------------------------------------------------------------------------- /src/main/frontend/styles/checkoutform.css: -------------------------------------------------------------------------------- 1 | 2 | /* Styles specifically for larger screens. */ 3 | @media (min-width: 893px) { 4 | 5 | /* Add a bit of padding between form and grid */ 6 | vaadin-grid { 7 | margin-left: 10px; 8 | min-width: 240px; 9 | } 10 | } 11 | 12 | /* This makes the whole view responsive; the layout wraps if there is not enough room. 13 | It also allows the grid to be on the right on big screens, and on top for small ones. 14 | */ 15 | .contentlayout { 16 | flex-wrap: wrap; 17 | flex-direction: row-reverse; 18 | } 19 | 20 | /* on smaller screens, add a bit of padding between grid and form (vertically) */ 21 | vaadin-grid { 22 | margin-bottom: 2em; 23 | min-width: 250px; 24 | flex-grow: 1; 25 | } -------------------------------------------------------------------------------- /src/main/frontend/views/README: -------------------------------------------------------------------------------- 1 | Place your React views or hand written templates in this folder. 2 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/AppNavLayout.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.vaadin.flow.component.tabs.TabsVariant; 7 | 8 | import com.vaadin.demo.views.IntroView; 9 | import com.vaadin.flow.component.Component; 10 | import com.vaadin.flow.component.applayout.AppLayout; 11 | import com.vaadin.flow.component.html.Anchor; 12 | import com.vaadin.flow.component.icon.Icon; 13 | import com.vaadin.flow.component.icon.VaadinIcon; 14 | import com.vaadin.flow.component.tabs.Tab; 15 | import com.vaadin.flow.component.tabs.Tabs; 16 | import com.vaadin.flow.router.AfterNavigationEvent; 17 | import com.vaadin.flow.router.AfterNavigationObserver; 18 | import com.vaadin.flow.router.ParentLayout; 19 | import com.vaadin.flow.router.RouterLink; 20 | 21 | @ParentLayout(MainView.class) 22 | public class AppNavLayout extends AppLayout implements AfterNavigationObserver { 23 | 24 | private final Tabs menu; 25 | 26 | public AppNavLayout() { 27 | getElement().getThemeList().add("app-nav-layout"); 28 | menu = createMenuTabs(); 29 | addToNavbar(menu); 30 | } 31 | 32 | private static Tabs createMenuTabs() { 33 | final Tabs tabs = new Tabs(); 34 | tabs.setOrientation(Tabs.Orientation.HORIZONTAL); 35 | tabs.add(getAvailableTabs()); 36 | tabs.addThemeVariants(TabsVariant.LUMO_MINIMAL); 37 | return tabs; 38 | } 39 | 40 | private static Tab[] getAvailableTabs() { 41 | final List tabs = new ArrayList<>(); 42 | tabs.add(createTab("Layouts", IntroView.class, VaadinIcon.LAYOUT)); 43 | tabs.add( 44 | createTab("GitHub", "https://github.com/vaadin/layout-examples", 45 | VaadinIcon.EXTERNAL_LINK)); 46 | return tabs.toArray(new Tab[tabs.size()]); 47 | } 48 | 49 | private static Tab createTab(String title, 50 | Class viewClass) { 51 | return createTab(new RouterLink(title, viewClass)); 52 | } 53 | 54 | private static Tab createTab(String title, 55 | Class viewClass, VaadinIcon icon) { 56 | return createTab(new Icon(icon), new RouterLink(title, viewClass)); 57 | } 58 | 59 | private static Tab createTab(String title, String href, VaadinIcon icon) { 60 | return createTab(new Icon(icon), new Anchor(href, title)); 61 | } 62 | 63 | private static Tab createTab(Component... content) { 64 | final Tab tab = new Tab(); 65 | tab.add(content); 66 | return tab; 67 | } 68 | 69 | @Override 70 | public void afterNavigation(AfterNavigationEvent event) { 71 | // Select the matching navigation tab on page load 72 | String location = event.getLocation().getFirstSegment(); 73 | menu.getChildren().forEach(component -> { 74 | if (component instanceof Tab) { 75 | Tab tab = (Tab) component; 76 | tab.getChildren().findFirst().ifPresent(component1 -> { 77 | if (component1 instanceof RouterLink) { 78 | RouterLink link = (RouterLink) component1; 79 | if (link.getHref().equals(location)) { 80 | menu.setSelectedTab(tab); 81 | } 82 | } 83 | }); 84 | } 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/MainView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo; 2 | 3 | import com.vaadin.flow.component.dependency.JsModule; 4 | import com.vaadin.flow.component.html.Div; 5 | import com.vaadin.flow.router.RouterLayout; 6 | 7 | /** 8 | * The main view is a top-level placeholder for other views. 9 | */ 10 | @JsModule("./src/utils.js") 11 | public class MainView extends Div implements RouterLayout { 12 | public MainView() { 13 | getElement().getStyle().set("height", "100%"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/components/ExAddContent.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.components; 2 | 3 | import com.vaadin.flow.component.Component; 4 | import com.vaadin.flow.component.Tag; 5 | import com.vaadin.flow.component.dependency.JsModule; 6 | 7 | /** 8 | * Server-side component for the {@code ex-add-content} component. 9 | */ 10 | @Tag("ex-add-content") 11 | @JsModule("./src/components/ex-add-content.js") 12 | public class ExAddContent extends Component { 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/components/ExCard.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.components; 2 | 3 | import com.vaadin.flow.component.Component; 4 | import com.vaadin.flow.component.HasComponents; 5 | import com.vaadin.flow.component.HasStyle; 6 | import com.vaadin.flow.component.Tag; 7 | import com.vaadin.flow.component.dependency.JsModule; 8 | 9 | /** 10 | * Server-side component for the {@code ex-card} example card element. 11 | */ 12 | @Tag("ex-card") 13 | @JsModule("./src/components/ex-card.js") 14 | public class ExCard extends Component implements HasStyle, HasComponents { 15 | 16 | public ExCard(String title) { 17 | setTitle(title); 18 | } 19 | 20 | public String getTitle() { 21 | return getElement().getProperty("title"); 22 | } 23 | 24 | public void setTitle(String title) { 25 | getElement().setProperty("title", title == null ? "" : title); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/entity/Book.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.entity; 2 | 3 | public class Book { 4 | 5 | private String image; 6 | private String title; 7 | private String author; 8 | private Double price; 9 | 10 | public Book(String image, String title, String author, Double price) { 11 | this.image = image; 12 | this.title = title; 13 | this.author = author; 14 | this.price = price; 15 | } 16 | 17 | public String getImage() { 18 | return image; 19 | } 20 | 21 | public void setImage(String image) { 22 | this.image = image; 23 | } 24 | 25 | public String getTitle() { 26 | return title; 27 | } 28 | 29 | public void setTitle(String title) { 30 | this.title = title; 31 | } 32 | 33 | public String getAuthor() { 34 | return author; 35 | } 36 | 37 | public void setAuthor(String author) { 38 | this.author = author; 39 | } 40 | 41 | public Double getPrice() { 42 | return price; 43 | } 44 | 45 | public void setPrice(Double price) { 46 | this.price = price; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/entity/Product.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.entity; 2 | 3 | import java.util.Objects; 4 | 5 | public class Product { 6 | private int id; 7 | private String name; 8 | private int price; 9 | private String description; 10 | 11 | public Product(int id, String name, int price, String description) { 12 | this.id = id; 13 | this.name = name; 14 | this.price = price; 15 | this.description = description; 16 | } 17 | 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public int getPrice() { 35 | return price; 36 | } 37 | 38 | public void setPrice(int price) { 39 | this.price = price; 40 | } 41 | 42 | public String getDescription() { 43 | return description; 44 | } 45 | 46 | public void setDescription(String description) { 47 | this.description = description; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return getName(); 53 | } 54 | 55 | @Override 56 | public boolean equals(Object o) { 57 | if (this == o) 58 | return true; 59 | if (!(o instanceof Product)) 60 | return false; 61 | Product product = (Product) o; 62 | return getId() == product.getId() && getPrice() == product.getPrice() 63 | && Objects.equals(getName(), product.getName()) 64 | && Objects.equals(getDescription(), product.getDescription()); 65 | } 66 | 67 | @Override 68 | public int hashCode() { 69 | return Objects.hash(getId(), getName(), getPrice(), getDescription()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/service/BookService.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.service; 2 | 3 | import com.vaadin.demo.entity.Book; 4 | 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | public class BookService { 9 | public static List fetchAll() { 10 | return Arrays.asList( 11 | new Book("images/Vaadin14.png", "Book of Vaadin 14", 12 | "Vaadin team", 30.0), 13 | new Book("images/LearningVaadin7.png", "Learning Vaadin 7", 14 | "Vaadin team", 20.0), 15 | new Book("images/VaadinReceipes.png", "Vaadin Receipes", 16 | "Vaadin team", 10.0), 17 | new Book("images/Vaadin7Cookbook.png", "Vaadin 7 Cookbook", 18 | "Vaadin team", 10.0), 19 | new Book("images/Vaadin7UIDesignByExample.png", 20 | "Vaadin 7 UI Design By Example", "Vaadin team", 20.0), 21 | new Book("images/VaadinPortletStarter.png", 22 | "Book of Vaadin (Vaadin Portlet Starter)", 23 | "Vaadin team", 12.00), 24 | new Book("images/DataCentricApplicationsWithVaadin.png", 25 | "Data-Centric Applications with Vaadin 8", 26 | "Alejandro Duarte", 34.99), 27 | new Book("images/Vaadin 7.png", "Book of Vaadin 7", 28 | "Vaadin team", 3.00), 29 | new Book("images/Vaadin 6.png", "Book of Vaadin 6", 30 | "Vaadin team", 2.89), 31 | new Book("images/Vaadin 6PreviewEdition.png", 32 | "Book of Vaadin 6 Preview Edition", "Vaadin team", 33 | 1.89)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/BasicAppLayoutView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.flow.component.UI; 5 | import com.vaadin.flow.component.applayout.AppLayout; 6 | import com.vaadin.flow.component.applayout.DrawerToggle; 7 | import com.vaadin.flow.component.button.Button; 8 | import com.vaadin.flow.component.html.H1; 9 | import com.vaadin.flow.component.html.Image; 10 | import com.vaadin.flow.component.html.Paragraph; 11 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 12 | import com.vaadin.flow.component.tabs.Tab; 13 | import com.vaadin.flow.component.tabs.Tabs; 14 | import com.vaadin.flow.router.PageTitle; 15 | import com.vaadin.flow.router.Route; 16 | 17 | @Route(value = "app-layout-basic", layout = MainView.class) 18 | @PageTitle("Basic App Layout") 19 | public class BasicAppLayoutView extends AppLayout { 20 | 21 | public BasicAppLayoutView() { 22 | Image img = new Image("https://i.imgur.com/GPpnszs.png", "Vaadin Logo"); 23 | img.setHeight("44px"); 24 | addToNavbar(new DrawerToggle(), img); 25 | Tabs tabs = new Tabs(new Tab("Home"), new Tab("About")); 26 | tabs.setOrientation(Tabs.Orientation.VERTICAL); 27 | addToDrawer(tabs); 28 | VerticalLayout main = new VerticalLayout(); 29 | 30 | Button sourceButton = new Button("View source code", 31 | new Image("icons/Github.png", "View source code"), 32 | event -> UI.getCurrent().getPage().setLocation( 33 | "https://github.com/vaadin/layout-examples/blob/master/src/main/java/com/vaadin/demo/views/BasicAppLayoutView.java")); 34 | 35 | main.add(new H1("Header text"), 36 | new Paragraph("Main content goes here."), sourceButton); 37 | setContent(main); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/CarouselExampleView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.flowingcode.vaadin.addons.carousel.Carousel; 4 | import com.flowingcode.vaadin.addons.carousel.Slide; 5 | import com.vaadin.flow.component.Component; 6 | import com.vaadin.flow.component.UI; 7 | import com.vaadin.flow.component.button.Button; 8 | import com.vaadin.flow.component.button.ButtonVariant; 9 | import com.vaadin.flow.component.html.Div; 10 | import com.vaadin.flow.component.html.H1; 11 | import com.vaadin.flow.component.html.Image; 12 | import com.vaadin.flow.component.orderedlayout.FlexComponent; 13 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 14 | import com.vaadin.flow.router.PageTitle; 15 | import com.vaadin.flow.router.Route; 16 | 17 | @Route("carousel") 18 | @PageTitle("Carousel example") 19 | public class CarouselExampleView extends VerticalLayout { 20 | 21 | public CarouselExampleView() { 22 | 23 | // A carousel contains multiple slides. Each slide can contain other 24 | // components. In this example, for each slide we have one layout 25 | // component. This program uses a 3rd party addon and to use it, 26 | // required dependency must be added to the pom.xml 27 | // More information can be found here: 28 | // https://vaadin.com/directory/component/carousel-addon/ 29 | Slide slide1 = new Slide(createSlide1Layout()); 30 | Slide slide2 = new Slide(createSlide2Layout()); 31 | Slide slide3 = new Slide(createSlide3Layout()); 32 | 33 | Carousel carousel = new Carousel(slide1, slide2, slide3) 34 | .withAutoProgress().withSlideDuration(4).withStartPosition(0); 35 | carousel.setHideNavigation(false); 36 | carousel.setWidthFull(); 37 | carousel.setHeight("500px"); 38 | 39 | Button sourceButton = new Button("View source code", 40 | new Image("icons/Github.png", "View source code"), 41 | event -> UI.getCurrent().getPage().setLocation( 42 | "https://github.com/vaadin/layout-examples/blob/master/src/main/java/com/vaadin/demo/views/CarouselExampleView.java")); 43 | 44 | add(carousel, sourceButton); 45 | } 46 | 47 | private Component createSlide3Layout() { 48 | // Content of the right slide 49 | VerticalLayout layout = new VerticalLayout(); 50 | configSlideLayout(layout); 51 | 52 | H1 headLine = new H1(); 53 | headLine.setText("One more for good measure."); 54 | headLine.getStyle().set("align-self", "flex-end"); 55 | headLine.getStyle().set("color", "white"); 56 | 57 | Div content = new Div(); 58 | content.getStyle().set("white-space", "pre-wrap"); 59 | content.setText("Cras justo odio, dapibus ac facilisis in, egestas" 60 | + " eget quam. Donec id elit non mi porta gravida at eget" 61 | + " metus. Nullam id dolor id nibh ultricies vehicula ut id " 62 | + "elit."); 63 | content.getStyle().set("align-self", "flex-end"); 64 | content.getStyle().set("color", "white"); 65 | content.getStyle().set("text-align", "end"); 66 | 67 | Button button = new Button("Browse gallery"); 68 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 69 | button.addThemeVariants(ButtonVariant.LUMO_LARGE); 70 | // Align button to right 71 | button.getStyle().set("margin-left", "auto"); 72 | layout.add(button, content, headLine); 73 | return layout; 74 | } 75 | 76 | private Component createSlide2Layout() { 77 | // Content of the second slide 78 | VerticalLayout layout = new VerticalLayout(); 79 | configSlideLayout(layout); 80 | 81 | H1 headLine = new H1(); 82 | headLine.setText("Another example headline."); 83 | headLine.getStyle().set("align-self", "center"); 84 | headLine.getStyle().set("color", "white"); 85 | Div content = new Div(); 86 | 87 | content.getStyle().set("white-space", "pre-wrap"); 88 | content.getStyle().set("text-align", "center"); 89 | 90 | content.setText("Cras justo odio, dapibus ac facilisis in, egestas" 91 | + " eget quam. Donec id elit non mi porta gravida at " 92 | + "eget metus. Nullam id dolor id nibh ultricies " 93 | + "vehicula ut id elit."); 94 | content.getStyle().set("align-self", "center"); 95 | content.getStyle().set("color", "white"); 96 | Button button = new Button("Sign up today"); 97 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 98 | button.addThemeVariants(ButtonVariant.LUMO_LARGE); 99 | // Align button to center 100 | button.getStyle().set("margin-left", "auto"); 101 | button.getStyle().set("margin-right", "auto"); 102 | layout.add(button, content, headLine); 103 | return layout; 104 | } 105 | 106 | private Component createSlide1Layout() { 107 | // Content of the third slide 108 | VerticalLayout layout = new VerticalLayout(); 109 | configSlideLayout(layout); 110 | 111 | H1 headLine = new H1(); 112 | headLine.setText("Example headline."); 113 | headLine.getStyle().set("color", "white"); 114 | Div content = new Div(); 115 | layout.getStyle().set("background-color", "#737A84"); 116 | content.setText( 117 | "Cras justo odio, dapibus ac facilisis in, egestas eget quam. " 118 | + "Donec id elit non mi porta gravida at eget metus. " 119 | + "Nullam id dolor id nibh ultricies vehicula ut id" 120 | + " elit."); 121 | content.getStyle().set("color", "white"); 122 | content.getStyle().set("white-space", "pre-wrap"); 123 | Button button = new Button("Sign up today"); 124 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 125 | button.addThemeVariants(ButtonVariant.LUMO_LARGE); 126 | layout.add(button, content, headLine); 127 | return layout; 128 | } 129 | 130 | private void configSlideLayout(VerticalLayout verticalLayout) { 131 | setAlignItems(FlexComponent.Alignment.CENTER); 132 | verticalLayout.setSizeFull(); 133 | verticalLayout.getStyle().set("padding-left", "10%"); 134 | verticalLayout.getStyle().set("padding-right", "10%"); 135 | verticalLayout.getStyle().set("padding-bottom", "10%"); 136 | verticalLayout.getStyle().set("flex-direction", "column-reverse"); 137 | verticalLayout.getStyle().set("background-color", "#737A84"); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/CenteredContentView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.flow.component.Tag; 5 | import com.vaadin.flow.component.dependency.JsModule; 6 | import com.vaadin.flow.component.html.Div; 7 | import com.vaadin.flow.component.html.Paragraph; 8 | import com.vaadin.flow.router.PageTitle; 9 | import com.vaadin.flow.router.Route; 10 | import com.vaadin.flow.component.littemplate.LitTemplate; 11 | import com.vaadin.flow.component.template.Id; 12 | 13 | @Route(value = "centered-content", layout = MainView.class) 14 | @PageTitle("Centered Content") 15 | @Tag("centered-content-view") 16 | @JsModule("./src/views/centered-content-view.js") 17 | public class CenteredContentView extends LitTemplate { 18 | 19 | @Id("main") 20 | Div main; 21 | 22 | public CenteredContentView() { 23 | main.add(new Paragraph("Main content goes here.")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/CheckoutFormView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import java.text.NumberFormat; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import java.util.Locale; 7 | 8 | import com.vaadin.demo.entity.Product; 9 | import com.vaadin.flow.component.UI; 10 | import com.vaadin.flow.component.button.Button; 11 | import com.vaadin.flow.component.button.ButtonVariant; 12 | import com.vaadin.flow.component.checkbox.Checkbox; 13 | import com.vaadin.flow.component.dependency.CssImport; 14 | import com.vaadin.flow.component.formlayout.FormLayout; 15 | import com.vaadin.flow.component.grid.ColumnTextAlign; 16 | import com.vaadin.flow.component.grid.Grid; 17 | import com.vaadin.flow.component.html.H1; 18 | import com.vaadin.flow.component.html.H2; 19 | import com.vaadin.flow.component.html.Hr; 20 | import com.vaadin.flow.component.html.Image; 21 | import com.vaadin.flow.component.icon.Icon; 22 | import com.vaadin.flow.component.icon.VaadinIcon; 23 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 24 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 25 | import com.vaadin.flow.component.radiobutton.RadioButtonGroup; 26 | import com.vaadin.flow.component.radiobutton.RadioGroupVariant; 27 | import com.vaadin.flow.component.select.Select; 28 | import com.vaadin.flow.component.textfield.TextField; 29 | import com.vaadin.flow.data.renderer.LitRenderer; 30 | import com.vaadin.flow.router.PageTitle; 31 | import com.vaadin.flow.router.Route; 32 | 33 | @Route("checkout-form") 34 | @PageTitle("Checkout form") 35 | @CssImport("./styles/checkoutform.css") 36 | public class CheckoutFormView extends VerticalLayout { 37 | 38 | public CheckoutFormView() { 39 | 40 | setAlignItems(Alignment.CENTER); 41 | setSpacing(true); 42 | setPadding(true); 43 | getStyle().set("padding-left", "10%"); 44 | getStyle().set("padding-right", "10%"); 45 | setWidthFull(); 46 | 47 | // This VerticalLayout contains addressHeader, formLayout, saveButton 48 | VerticalLayout billingAddressLayout = new VerticalLayout(); 49 | billingAddressLayout.setWidth("65%"); 50 | billingAddressLayout.setMinWidth("300px"); 51 | billingAddressLayout.setSpacing(true); 52 | billingAddressLayout.setPadding(false); 53 | 54 | // Flex-grow of the formLayout and Grid are set to 1 to be grown with 55 | // the same portion. 56 | billingAddressLayout.getElement().getStyle().set("flex-grow", "1"); 57 | 58 | // Main header of the form 59 | H1 header = new H1(); 60 | header.setText("Checkout form"); 61 | header.setWidthFull(); 62 | header.getStyle().set("text-align", "center"); 63 | header.getStyle().set("font-weight", "bold"); 64 | 65 | // To give the page the ability of wrapping, a HorizontalLayout is used, 66 | // it contains a formLayout and a grid. flex-wrap and flex-direction 67 | // help to wrap the page and give the direction of wrapping. 68 | // When it is wrapped Grid goes up. 69 | HorizontalLayout contentLayout = new HorizontalLayout(); 70 | contentLayout.addClassName("contentlayout"); 71 | contentLayout.setSpacing(false); 72 | contentLayout.setHeightFull(); 73 | contentLayout.setWidthFull(); 74 | 75 | // A formLayout is used to add the fields. It is also responsive. 76 | FormLayout formLayout = new FormLayout(); 77 | formLayout.setResponsiveSteps( 78 | new FormLayout.ResponsiveStep("10em", 1, 79 | FormLayout.ResponsiveStep.LabelsPosition.TOP), 80 | new FormLayout.ResponsiveStep("20em", 3, 81 | FormLayout.ResponsiveStep.LabelsPosition.TOP), 82 | new FormLayout.ResponsiveStep("30em", 6, 83 | FormLayout.ResponsiveStep.LabelsPosition.TOP)); 84 | 85 | formLayout.setWidthFull(); 86 | 87 | // Header for the Billing address fields. 88 | H2 addressHeader = new H2(); 89 | addressHeader.setText("Billing address"); 90 | addressHeader.getStyle().set("margin", "0"); 91 | 92 | // Items related to the billing address are created and added to the 93 | // FormLayout. 94 | TextField name = new TextField(); 95 | name.setWidthFull(); 96 | formLayout.setColspan(formLayout.addFormItem(name, "Name"), 3); 97 | 98 | TextField lastName = new TextField(); 99 | lastName.setWidthFull(); 100 | formLayout.setColspan(formLayout.addFormItem(lastName, "Last name"), 3); 101 | 102 | TextField username = new TextField(); 103 | username.setWidthFull(); 104 | formLayout.setColspan(formLayout.addFormItem(username, "Username"), 6); 105 | 106 | TextField email = new TextField(); 107 | email.setWidthFull(); 108 | email.setPlaceholder("you@example.com"); 109 | formLayout.setColspan(formLayout.addFormItem(email, "Email (Optional)"), 110 | 6); 111 | 112 | TextField address1 = new TextField(); 113 | address1.setWidthFull(); 114 | address1.setPlaceholder("1234 Main St"); 115 | formLayout.setColspan(formLayout.addFormItem(address1, "Address"), 6); 116 | 117 | TextField address2 = new TextField(); 118 | address2.setWidthFull(); 119 | address2.setPlaceholder("Apartment or suite"); 120 | formLayout.setColspan( 121 | formLayout.addFormItem(address2, "Address2 (Optional)"), 6); 122 | 123 | Select country = new Select<>(); 124 | country.setWidthFull(); 125 | country.setItems("Finland", "Germany", "United States"); 126 | formLayout.setColspan(formLayout.addFormItem(country, "Country"), 2); 127 | 128 | Select state = new Select<>(); 129 | state.setWidthFull(); 130 | state.setItems("Florida", "California", "Texas", "Utah"); 131 | formLayout.setColspan(formLayout.addFormItem(state, "State"), 2); 132 | 133 | TextField zip = new TextField(); 134 | zip.setWidthFull(); 135 | formLayout.setColspan(formLayout.addFormItem(zip, "Zip"), 2); 136 | 137 | Hr upHR = new Hr(); 138 | formLayout.setColspan(formLayout.addFormItem(upHR, ""), 6); 139 | 140 | Checkbox shippingAddress = new Checkbox(); 141 | shippingAddress.setWidthFull(); 142 | shippingAddress 143 | .setLabel("Shipping address is the same as my billing address"); 144 | formLayout.setColspan(formLayout.addFormItem(shippingAddress, ""), 6); 145 | 146 | Checkbox saveInformation = new Checkbox(); 147 | saveInformation.setWidthFull(); 148 | saveInformation.setLabel("Save this information for next time"); 149 | formLayout.setColspan(formLayout.addFormItem(saveInformation, ""), 6); 150 | 151 | Hr downHR = new Hr(); 152 | formLayout.setColspan(formLayout.addFormItem(downHR, ""), 6); 153 | 154 | H2 paymentHeader = new H2(); 155 | paymentHeader.setText("Payment"); 156 | formLayout.setColspan(formLayout.addFormItem(paymentHeader, ""), 6); 157 | 158 | // Items related to payment are created and added to the FormLayout. 159 | RadioButtonGroup radioGroup = new RadioButtonGroup<>(); 160 | radioGroup.setItems("Credit card", "Debit card", "PayPal"); 161 | radioGroup.addThemeVariants(RadioGroupVariant.LUMO_VERTICAL); 162 | formLayout.setColspan(formLayout.addFormItem(radioGroup, ""), 6); 163 | 164 | TextField nameOnCard = new TextField(); 165 | nameOnCard.setWidthFull(); 166 | formLayout.setColspan( 167 | formLayout.addFormItem(nameOnCard, "Name on card"), 3); 168 | 169 | TextField creditCardNumber = new TextField(); 170 | creditCardNumber.setWidthFull(); 171 | formLayout.setColspan( 172 | formLayout.addFormItem(creditCardNumber, "Credit card number"), 173 | 3); 174 | 175 | TextField expiration = new TextField(); 176 | expiration.setWidthFull(); 177 | formLayout.setColspan(formLayout.addFormItem(expiration, "Expiration"), 178 | 1); 179 | 180 | TextField cVV = new TextField(); 181 | cVV.setWidthFull(); 182 | formLayout.setColspan(formLayout.addFormItem(cVV, "CVV"), 1); 183 | 184 | Button saveButton = new Button("Continue to checkout", 185 | new Icon(VaadinIcon.ARROW_RIGHT)); 186 | saveButton.addThemeVariants(ButtonVariant.LUMO_LARGE, 187 | ButtonVariant.LUMO_PRIMARY); 188 | 189 | // Aligns button to the right 190 | saveButton.getStyle().set("margin-left", "auto"); 191 | 192 | List list = new ArrayList<>(); 193 | list.add(new Product(1, "Vanilla cracker", 7, "With wholemeal flour")); 194 | list.add(new Product(2, "Vanilla blueberry cake", 8, 195 | "With blueberry jam")); 196 | list.add(new Product(3, "Vanilla pastry", 5, "with wholemeal flour")); 197 | list.add(new Product(4, "Blueberry cheese cake", 5, 198 | "With blueberry jam")); 199 | 200 | // Using a grid to show the purchased items. 201 | Grid grid = new Grid<>(); 202 | grid.setItems(list); 203 | grid.setWidth("30%"); 204 | NumberFormat moneyFormat = NumberFormat.getCurrencyInstance(Locale.US); 205 | 206 | // Using Template to show two properties, one on top of another 207 | // property. 208 | grid.addColumn(LitRenderer. of( 209 | "
[[item.name]]
[[item.description]]
") 210 | .withProperty("name", Product::getName) 211 | .withProperty("description", Product::getDescription)) 212 | .setWidth("70%"); 213 | grid.addColumn(LitRenderer 214 | . of("
[[item.price]]
").withProperty("price", 215 | order -> moneyFormat.format(order.getPrice()))) 216 | .setTextAlign(ColumnTextAlign.END).setWidth("30%"); 217 | 218 | Button sourceButton = new Button("View source code", 219 | new Image("icons/Github.png", "View source code"), 220 | event -> UI.getCurrent().getPage().setLocation( 221 | "https://github.com/vaadin/layout-examples/blob/master/src/main/java/com/vaadin/demo/views/CheckoutFormView.java")); 222 | 223 | billingAddressLayout.add(addressHeader, formLayout, saveButton, 224 | sourceButton); 225 | contentLayout.add(grid, billingAddressLayout); 226 | add(header, contentLayout); 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/FixedNavStickyFooterView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.demo.components.ExAddContent; 5 | import com.vaadin.flow.component.Tag; 6 | import com.vaadin.flow.component.button.Button; 7 | import com.vaadin.flow.component.dependency.JsModule; 8 | import com.vaadin.flow.component.html.Anchor; 9 | import com.vaadin.flow.component.html.Div; 10 | import com.vaadin.flow.component.html.H1; 11 | import com.vaadin.flow.component.html.Header; 12 | import com.vaadin.flow.component.html.Paragraph; 13 | import com.vaadin.flow.component.textfield.TextField; 14 | import com.vaadin.flow.router.PageTitle; 15 | import com.vaadin.flow.router.Route; 16 | import com.vaadin.flow.router.RouterLink; 17 | import com.vaadin.flow.component.littemplate.LitTemplate; 18 | import com.vaadin.flow.component.template.Id; 19 | 20 | @Route(value = "fixed-nav-sticky-footer", layout = MainView.class) 21 | @PageTitle("Fixed Nav & Sticky Footer") 22 | @Tag("fixed-nav-sticky-footer-view") 23 | @JsModule("./src/views/fixed-nav-sticky-footer-view.js") 24 | public class FixedNavStickyFooterView extends LitTemplate { 25 | 26 | @Id("header") 27 | Header header; 28 | 29 | @Id("main") 30 | Div main; 31 | 32 | @Id("footer") 33 | Div footer; 34 | 35 | public FixedNavStickyFooterView() { 36 | createHeader(); 37 | 38 | main.add(new H1("Sticky footer with fixed navbar")); 39 | main.add(new Paragraph("Footer pinned to the bottom of the viewport." 40 | + " If there is more content than fits the viewport, the footer" 41 | + " will be pushed down and will be visible only when scrolled" 42 | + " to the bottom of the page.")); 43 | main.add(new ExAddContent()); 44 | 45 | footer.add(new Paragraph("Place sticky footer content here.")); 46 | } 47 | 48 | public void createHeader() { 49 | RouterLink titleLink = new RouterLink("Fixed navbar", getClass()); 50 | titleLink.addClassName("titleLink"); 51 | header.add(titleLink); 52 | header.add(new RouterLink("Home", getClass())); 53 | header.add(new Anchor("#", "Link")); 54 | Anchor a = new Anchor("#", "Help"); 55 | // Stretches this item in the flex container so that the following items 56 | // will be at the right side of the screen. 57 | a.getStyle().set("margin-right", "auto"); 58 | header.add(a); 59 | 60 | Div searchBlock = new Div(); 61 | searchBlock.addClassName("searchBlock"); 62 | TextField searchField = new TextField(); 63 | searchField.setPlaceholder("Search"); 64 | searchField.addClassName("searchField"); 65 | searchBlock.add(searchField); 66 | 67 | Button searchButton = new Button("Search"); 68 | searchButton.addClassName("searchButton"); 69 | searchBlock.add(searchButton); 70 | 71 | header.add(searchBlock); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/HorizontalExamplesView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.flow.component.Html; 4 | import com.vaadin.flow.component.Text; 5 | import com.vaadin.flow.component.button.Button; 6 | import com.vaadin.flow.component.button.ButtonVariant; 7 | import com.vaadin.flow.component.html.H2; 8 | import com.vaadin.flow.component.html.H3; 9 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 10 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 11 | import com.vaadin.flow.router.PageTitle; 12 | import com.vaadin.flow.router.Route; 13 | 14 | @Route("horizontal") 15 | @PageTitle("HorizontalLayout Examples") 16 | public class HorizontalExamplesView extends VerticalLayout { 17 | 18 | public HorizontalExamplesView() { 19 | setSpacing(true); 20 | setPadding(true); 21 | 22 | add(new H2("Horizontal Layout Examples")); 23 | 24 | add(new Text("Each layout has a width of 100%, and a gray background color for better visibility.")); 25 | 26 | category("Margin and Padding"); 27 | 28 | HorizontalLayout layout = createLayout("Basic example with default settings"); 29 | layout.add(button("Button one"), button("Button two")); 30 | 31 | layout = createLayout("Basic example without spacing"); 32 | layout.setSpacing(false); 33 | layout.add(button("Button one"), button("Button two")); 34 | 35 | layout = createLayout("Basic example with margins"); 36 | layout.setMargin(true); 37 | layout.add(button("Button one"), button("Button two")); 38 | 39 | layout = createLayout("Basic example with padding"); 40 | layout.setPadding(true); 41 | layout.add(button("Button one"), button("Button two")); 42 | 43 | layout = createLayout("Basic example with margin and padding"); 44 | layout.setPadding(true); 45 | layout.setMargin(true); 46 | layout.add(button("Button one"), button("Button two")); 47 | 48 | category("Scrolling"); 49 | 50 | layout = createLayout("Enable scrolling"); 51 | layout.setPadding(true); 52 | layout.add(button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), 53 | button("Button"), button("Button"), button("Button"), button("Button"), button("Button")); 54 | Button button = button("Mushroom"); 55 | button.getStyle().set("flex-shrink", "0"); // necessary so that the layout doesn't try to shrink the button. The final 56 | // button doesn't have this addition and demonstrates the issue. 57 | layout.add(button); 58 | button = button("Mushroom"); 59 | layout.add(button); 60 | layout.getStyle().set("overflow", "scroll"); 61 | 62 | category("Size and Positioning"); 63 | 64 | layout = createLayout("Height set to 150px (with padding)"); 65 | layout.setPadding(true); 66 | layout.setHeight("150px"); 67 | layout.add(button("Button one"), button("Button two")); 68 | 69 | layout = createLayout("Aligning all items"); 70 | layout.setPadding(true); 71 | layout.setHeight("150px"); 72 | layout.setAlignItems(Alignment.END); 73 | layout.add(button("Button one"), button("Button two")); 74 | 75 | layout = createLayout("Aligning individual items"); 76 | layout.setPadding(true); 77 | layout.setHeight("150px"); 78 | button = button("Align start"); 79 | layout.add(button); 80 | layout.setVerticalComponentAlignment(Alignment.START, button); 81 | button = button("Align center"); 82 | layout.add(button); 83 | layout.setVerticalComponentAlignment(Alignment.CENTER, button); 84 | button = button("Align end"); 85 | layout.add(button); 86 | layout.setVerticalComponentAlignment(Alignment.END, button); 87 | button = button("Strech"); 88 | layout.add(button); 89 | button.setHeight("auto"); 90 | 91 | layout = createLayout("Expanding one component"); 92 | layout.setPadding(true); 93 | button = button("Button one"); 94 | layout.add(button, button("Button two")); 95 | layout.setFlexGrow(1, button); // this expands the button 96 | 97 | layout = createLayout("Expanding both components"); 98 | layout.setPadding(true); 99 | layout.addAndExpand(button("Button one"), button("Button two")); // adds and flex-grows both components 100 | 101 | layout = createLayout("Split positioning (without expanding either component)"); 102 | layout.setPadding(true); 103 | button = button("Button two"); 104 | button.getStyle().set("margin-left", "auto"); // expands the empty space left of button two 105 | layout.add(button("Button one"), button); 106 | 107 | layout = createLayout("Advanced split positioning 1"); 108 | layout.setPadding(true); 109 | button = button("Button two"); 110 | button.getStyle().set("margin-right", "auto");// expands the empty space right of button two 111 | layout.add(button("Button one"), button, button("Button three")); 112 | 113 | layout = createLayout("Advanced split positioning 2"); 114 | layout.setPadding(true); 115 | button = button("Button two"); 116 | button.getStyle().set("margin-left", "auto");// expands the empty space left of button two 117 | layout.add(button("Button one"), button, button("Button three")); 118 | 119 | } 120 | 121 | private void category(String string) { 122 | add(new H3(string)); 123 | } 124 | 125 | private Button button(String caption) { 126 | Button button = new Button(caption); 127 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 128 | return button; 129 | } 130 | 131 | private HorizontalLayout createLayout(String caption) { 132 | HorizontalLayout hl = new HorizontalLayout(); 133 | hl.setWidthFull(); 134 | hl.getStyle().set("background-color", "#dddddd"); 135 | add(new Text(caption)); 136 | add(hl); 137 | add(new Html(" ")); // spacer 138 | return hl; 139 | } 140 | 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/IntroView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.AppNavLayout; 4 | import com.vaadin.flow.component.Tag; 5 | import com.vaadin.flow.component.dependency.JsModule; 6 | import com.vaadin.flow.router.PageTitle; 7 | import com.vaadin.flow.router.Route; 8 | import com.vaadin.flow.component.littemplate.LitTemplate; 9 | import com.vaadin.flow.component.template.Id; 10 | 11 | @Route(value = "", layout = AppNavLayout.class) 12 | @PageTitle("Layout Examples for Vaadin 14") 13 | @Tag("intro-view") 14 | @JsModule("./src/views/intro-view.js") 15 | public class IntroView extends LitTemplate { 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/ListingFormView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.entity.Book; 4 | import com.vaadin.demo.service.BookService; 5 | import com.vaadin.flow.component.Component; 6 | import com.vaadin.flow.component.UI; 7 | import com.vaadin.flow.component.button.Button; 8 | import com.vaadin.flow.component.html.H3; 9 | import com.vaadin.flow.component.html.Hr; 10 | import com.vaadin.flow.component.html.Image; 11 | import com.vaadin.flow.component.html.Span; 12 | import com.vaadin.flow.component.menubar.MenuBar; 13 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 14 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 15 | import com.vaadin.flow.component.textfield.TextField; 16 | import com.vaadin.flow.router.Route; 17 | import com.vaadin.flow.router.RouterLink; 18 | 19 | import java.util.List; 20 | 21 | @Route("listing") 22 | public class ListingFormView extends VerticalLayout { 23 | 24 | public ListingFormView() { 25 | setSizeFull(); 26 | 27 | Component header = createHeader(); 28 | Component filter = createFilter(); 29 | 30 | VerticalLayout booksLayout = new VerticalLayout(); 31 | booksLayout.setWidth("70%"); 32 | 33 | List books = BookService.fetchAll(); 34 | for (Book book : books) { 35 | booksLayout.add(createBookComponent(book.getImage(), 36 | book.getTitle(), book.getAuthor(), book.getPrice())); 37 | booksLayout.add(new Hr()); 38 | } 39 | 40 | HorizontalLayout mainLayout = new HorizontalLayout(); 41 | mainLayout.add(filter, booksLayout); 42 | 43 | Button sourceButton = new Button("View source code", 44 | new Image("icons/Github.png", "View source code"), 45 | event -> UI.getCurrent().getPage().setLocation( 46 | "https://github.com/vaadin/layout-examples/blob/master/src/main/java/com/vaadin/demo/views/ListingFormView.java")); 47 | 48 | add(header, mainLayout, sourceButton); 49 | } 50 | 51 | private Component createFilter() { 52 | VerticalLayout layout = new VerticalLayout(); 53 | layout.setWidth("30%"); 54 | layout.setPadding(false); 55 | layout.getStyle().set("background-color", "#F5F5F5"); 56 | layout.getElement().getStyle().set("flex-grow", "1"); 57 | 58 | Span formatSpan = new Span("Format"); 59 | formatSpan.setWidthFull(); 60 | formatSpan.getStyle().set("text-align", "center"); 61 | formatSpan.getStyle().set("background-color", "#D5D8DC"); 62 | 63 | RouterLink paperback = new RouterLink("Paperback", 64 | ListingFormView.class); 65 | RouterLink hardback = new RouterLink("Hardback", ListingFormView.class); 66 | RouterLink audio = new RouterLink("Audio", ListingFormView.class); 67 | layout.add(formatSpan, hardback, paperback, audio); 68 | 69 | Span priceSpan = new Span("Price"); 70 | priceSpan.setWidthFull(); 71 | priceSpan.getStyle().set("text-align", "center"); 72 | priceSpan.getStyle().set("background-color", "#D5D8DC"); 73 | 74 | RouterLink price1 = new RouterLink("5$-10$", ListingFormView.class); 75 | RouterLink price2 = new RouterLink("10$-20$", ListingFormView.class); 76 | RouterLink price3 = new RouterLink("20$-50$", ListingFormView.class); 77 | RouterLink price4 = new RouterLink("Over 50$", ListingFormView.class); 78 | 79 | layout.add(priceSpan, price1, price2, price3, price4); 80 | 81 | Span authorSpan = new Span("Author"); 82 | authorSpan.setWidthFull(); 83 | authorSpan.getStyle().set("text-align", "center"); 84 | authorSpan.getStyle().set("background-color", "#D5D8DC"); 85 | 86 | RouterLink author1 = new RouterLink("Vaadin", ListingFormView.class); 87 | RouterLink author2 = new RouterLink("Vaadin team", 88 | ListingFormView.class); 89 | RouterLink author3 = new RouterLink("Alejandro Duarte", 90 | ListingFormView.class); 91 | RouterLink author4 = new RouterLink("Marko Grönroos", 92 | ListingFormView.class); 93 | 94 | layout.add(authorSpan, author1, author2, author3, author4); 95 | return layout; 96 | } 97 | 98 | private Component createHeader() { 99 | MenuBar menuBar = new MenuBar(); 100 | menuBar.getStyle().set("flex-grow", "1"); 101 | menuBar.addItem("Today's Deals"); 102 | menuBar.addItem("Help"); 103 | menuBar.addItem("Registry"); 104 | 105 | // This HorizontalLayout contains the menuBar, searchTextField and 106 | // searchButton. 107 | HorizontalLayout headerLayout = new HorizontalLayout(); 108 | headerLayout.setWidthFull(); 109 | TextField searchTextField = new TextField(); 110 | searchTextField.getStyle().set("overflow", "auto"); 111 | searchTextField.setPlaceholder("Search"); 112 | searchTextField.setValue("Vaadin"); 113 | Button searchButton = new Button("Search"); 114 | searchButton.getStyle().set("overflow", "auto"); 115 | headerLayout.add(menuBar, searchTextField, searchButton); 116 | headerLayout.getStyle().set("background-color", "#F8F8F8"); 117 | headerLayout.getStyle().set("flex-shrink", "0"); 118 | return headerLayout; 119 | } 120 | 121 | private Component createBookComponent(String imageAddress, String title, 122 | String author, double price) { 123 | HorizontalLayout mainLayout = new HorizontalLayout(); 124 | mainLayout.getStyle().set("flex-shrink", "0"); 125 | Image image = new Image(imageAddress, ""); 126 | image.setWidth("30%"); 127 | image.setHeight("40%"); 128 | 129 | VerticalLayout itemLayout = new VerticalLayout(); 130 | H3 titleComponent = new H3(title); 131 | Span authorComponent = new Span("by " + author); 132 | Span priceComponent = new Span("$ " + price); 133 | itemLayout.add(titleComponent, authorComponent, priceComponent); 134 | 135 | mainLayout.add(image, itemLayout); 136 | return mainLayout; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/LoginFormView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.flow.component.Tag; 5 | import com.vaadin.flow.component.button.Button; 6 | import com.vaadin.flow.component.dependency.JsModule; 7 | import com.vaadin.flow.component.notification.Notification; 8 | import com.vaadin.flow.component.textfield.PasswordField; 9 | import com.vaadin.flow.component.textfield.TextField; 10 | import com.vaadin.flow.router.PageTitle; 11 | import com.vaadin.flow.router.Route; 12 | import com.vaadin.flow.component.littemplate.LitTemplate; 13 | import com.vaadin.flow.component.template.Id; 14 | 15 | @Route(value = "login-form", layout = MainView.class) 16 | @PageTitle("Login Form") 17 | @Tag("login-form-view") 18 | @JsModule("./src/views/login-form-view.js") 19 | public class LoginFormView extends LitTemplate { 20 | 21 | @Id("usernameField") 22 | TextField usernameField; 23 | 24 | @Id("passwordField") 25 | PasswordField passwordField; 26 | 27 | @Id("loginButton") 28 | Button loginButton; 29 | 30 | @Id("forgotPasswordButton") 31 | Button forgotPasswordButton; 32 | 33 | public LoginFormView() { 34 | loginButton.addClickListener(event -> Notification.show( 35 | "User '" + usernameField.getValue() + "' clicked login.")); 36 | forgotPasswordButton.addClickListener( 37 | event -> Notification.show("User '" + usernameField.getValue() 38 | + "' clicked forgot password.")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/MarketingView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.flow.component.Component; 4 | import com.vaadin.flow.component.UI; 5 | import com.vaadin.flow.component.button.Button; 6 | import com.vaadin.flow.component.button.ButtonVariant; 7 | import com.vaadin.flow.component.html.Div; 8 | import com.vaadin.flow.component.html.H1; 9 | import com.vaadin.flow.component.html.H2; 10 | import com.vaadin.flow.component.html.Image; 11 | import com.vaadin.flow.component.icon.Icon; 12 | import com.vaadin.flow.component.icon.VaadinIcon; 13 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 14 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 15 | import com.vaadin.flow.router.PageTitle; 16 | import com.vaadin.flow.router.Route; 17 | 18 | @Route("marketing") 19 | @PageTitle("Marketing page") 20 | public class MarketingView extends VerticalLayout { 21 | 22 | public MarketingView() { 23 | setSizeFull(); 24 | setSpacing(true); 25 | setPadding(true); 26 | 27 | // This VerticalLayout contains the header, contentDiv and button. 28 | VerticalLayout layout = new VerticalLayout(); 29 | layout.getStyle().set("padding-left", "20%"); 30 | layout.getStyle().set("padding-right", "20%"); 31 | layout.getStyle().set("background-color", "#F5F5F5"); 32 | layout.getStyle().set("flex-shrink", "0"); 33 | layout.setHeight("50%"); 34 | layout.setWidthFull(); 35 | layout.setSpacing(false); 36 | 37 | H1 header = new H1("Hello, world!"); 38 | header.setWidthFull(); 39 | Div contentDiv = new Div(); 40 | contentDiv.setText( 41 | "This is a template for a simple marketing or informational " 42 | + "website. It includes three supporting pieces of " 43 | + "content. Use it as a starting point to create " 44 | + "something more unique."); 45 | Button button = new Button("Learn more", 46 | new Icon(VaadinIcon.ANGLE_DOUBLE_RIGHT)); 47 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 48 | 49 | layout.add(header, contentDiv, button); 50 | 51 | // This HorizontalLayout contains box1, box2 and box3. 52 | HorizontalLayout container = new HorizontalLayout(); 53 | container.setSpacing(false); 54 | container.getStyle().set("flex-wrap", "wrap"); 55 | container.setSizeFull(); 56 | container.getStyle().set("padding-left", "20%"); 57 | container.getStyle().set("padding-right", "20%"); 58 | 59 | String cardHeader = "Heading"; 60 | String cardContent = "Donec id elit non mi porta gravida at eget" 61 | + " metus. Fusce dapibus, tellus ac cursus commodo, tortor" 62 | + " mauris condimentum nibh, ut fermentum massa justo sit amet " 63 | + "risus. Etiam porta sem malesuada magna mollis euismod. " 64 | + "Donec sed odio dui."; 65 | 66 | Component card1 = createCard(cardHeader, cardContent); 67 | Component card2 = createCard(cardHeader, cardContent); 68 | Component card3 = createCard(cardHeader, cardContent); 69 | 70 | container.add(card1, card2, card3); 71 | Button sourceButton = new Button("View source code", 72 | new Image("icons/Github.png", "View source code"), 73 | event -> UI.getCurrent().getPage().setLocation( 74 | "https://github.com/vaadin/layout-examples/blob/master/src/main/java/com/vaadin/demo/views/MarketingView.java")); 75 | 76 | add(layout, container, sourceButton); 77 | } 78 | 79 | private Component createCard(String cardHeader, String cardContent) { 80 | VerticalLayout layout = new VerticalLayout(); 81 | layout.setWidth("30%"); 82 | layout.setMinWidth("250px"); 83 | 84 | H2 header = new H2(cardHeader); 85 | Div content = new Div(); 86 | content.setText(cardContent); 87 | 88 | Button button = new Button("View details", 89 | new Icon(VaadinIcon.ANGLE_DOUBLE_RIGHT)); 90 | button.addThemeVariants(ButtonVariant.LUMO_SMALL); 91 | 92 | layout.getElement().getStyle().set("flex-grow", "1"); 93 | layout.add(header, content, button); 94 | return layout; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/PricingView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.demo.components.ExAddContent; 5 | import com.vaadin.demo.components.ExCard; 6 | import com.vaadin.flow.component.Component; 7 | import com.vaadin.flow.component.Tag; 8 | import com.vaadin.flow.component.button.Button; 9 | import com.vaadin.flow.component.button.ButtonVariant; 10 | import com.vaadin.flow.component.dependency.JsModule; 11 | import com.vaadin.flow.component.html.Anchor; 12 | import com.vaadin.flow.component.html.Div; 13 | import com.vaadin.flow.component.html.H1; 14 | import com.vaadin.flow.component.html.H2; 15 | import com.vaadin.flow.component.html.ListItem; 16 | import com.vaadin.flow.component.html.Paragraph; 17 | import com.vaadin.flow.component.html.UnorderedList; 18 | import com.vaadin.flow.component.icon.Icon; 19 | import com.vaadin.flow.component.icon.VaadinIcon; 20 | import com.vaadin.flow.component.menubar.MenuBar; 21 | import com.vaadin.flow.component.menubar.MenuBarVariant; 22 | import com.vaadin.flow.router.PageTitle; 23 | import com.vaadin.flow.router.Route; 24 | import com.vaadin.flow.component.littemplate.LitTemplate; 25 | import com.vaadin.flow.component.template.Id; 26 | 27 | @Route(value = "pricing", layout = MainView.class) 28 | @PageTitle("Pricing") 29 | @Tag("pricing-view") 30 | @JsModule("./src/views/pricing-view.js") 31 | public class PricingView extends LitTemplate { 32 | 33 | @Id("header") 34 | Div header; 35 | 36 | @Id("main") 37 | Div main; 38 | 39 | @Id("footer") 40 | Div footer; 41 | 42 | public PricingView() { 43 | createHeader(); 44 | 45 | Div hero = new Div(); 46 | hero.addClassName("hero"); 47 | hero.add(new H1("Pricing")); 48 | hero.add(new Paragraph( 49 | "Quickly build an effective pricing table for your potential" 50 | + " customers with this Vaadin layout example. It’s built" 51 | + " with Vaadin components and utilities some customization.")); 52 | main.add(hero); 53 | 54 | Div cardList = new Div(); 55 | cardList.addClassName("card-list"); 56 | ExCard card; 57 | Button button; 58 | 59 | card = new ExCard("Free"); 60 | card.add(new UnorderedList(new ListItem("10 users included"), 61 | new ListItem("2 GB of storage"), new ListItem("Email support"), 62 | new ListItem("Help center access"))); 63 | card.add(new Button("Sign up for free")); 64 | cardList.add(card); 65 | 66 | card = new ExCard("Pro"); 67 | card.add(new UnorderedList(new ListItem("20 users included"), 68 | new ListItem("10 GB of storage"), 69 | new ListItem("Priority email support"), 70 | new ListItem("Help center access"))); 71 | button = new Button("Get started"); 72 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 73 | card.add(button); 74 | cardList.add(card); 75 | 76 | card = new ExCard("Enterprise"); 77 | card.add(new UnorderedList(new ListItem("30 users included"), 78 | new ListItem("15 GB of storage"), 79 | new ListItem("Phone and email support"), 80 | new ListItem("Help center access"))); 81 | button = new Button("Contact us"); 82 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 83 | card.add(button); 84 | cardList.add(card); 85 | 86 | main.add(cardList); 87 | 88 | main.add(new ExAddContent()); 89 | 90 | createFooter(); 91 | } 92 | 93 | public Component createTopMenu() { 94 | MenuBar menuBar = new MenuBar(); 95 | menuBar.addThemeVariants(MenuBarVariant.LUMO_TERTIARY); 96 | menuBar.addItem(new Anchor("#features", "Features")); 97 | menuBar.addItem(new Anchor("#enterprise", "Enterprise")); 98 | menuBar.addItem(new Anchor("#support", "Support")); 99 | menuBar.addItem(new Anchor("#pricing", "Pricing")); 100 | menuBar.addItem(new Button("Sign up")); 101 | return menuBar; 102 | } 103 | 104 | public void createHeader() { 105 | header.add(new H2("Company name"), createTopMenu()); 106 | } 107 | 108 | private void createFooter() { 109 | Div box; 110 | 111 | box = new Div(); 112 | box.addClassName("copyright-box"); 113 | Paragraph copyright = new Paragraph("© 2019"); 114 | copyright.addClassName("copyright"); 115 | box.add(new Icon(VaadinIcon.VAADIN_H), copyright); 116 | footer.add(box); 117 | 118 | box = new Div(); 119 | box.add(new H2("Features")); 120 | box.add(new UnorderedList(new ListItem(new Anchor("#", "Cool stuff")), 121 | new ListItem(new Anchor("#", "Random feature")), 122 | new ListItem(new Anchor("#", "Team feature")), 123 | new ListItem(new Anchor("#", "Stuff for developers")), 124 | new ListItem(new Anchor("#", "Another one")), 125 | new ListItem(new Anchor("#", "Last time")))); 126 | footer.add(box); 127 | 128 | box = new Div(); 129 | box.add(new H2("Resources")); 130 | box.add(new UnorderedList(new ListItem(new Anchor("#", "Resource")), 131 | new ListItem(new Anchor("#", "Resource name")), 132 | new ListItem(new Anchor("#", "Another resource")), 133 | new ListItem(new Anchor("#", "Final resource")))); 134 | footer.add(box); 135 | 136 | box = new Div(); 137 | box.add(new H2("About")); 138 | box.add(new UnorderedList(new ListItem(new Anchor("#", "Team")), 139 | new ListItem(new Anchor("#", "Locations")), 140 | new ListItem(new Anchor("#", "Privacy")), 141 | new ListItem(new Anchor("#", "Terms")))); 142 | footer.add(box); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/ThreeColumnsView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.flow.component.html.Anchor; 4 | import com.vaadin.flow.component.html.Div; 5 | import com.vaadin.flow.component.html.H1; 6 | import com.vaadin.flow.component.html.Paragraph; 7 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 8 | import com.vaadin.flow.router.PageTitle; 9 | import com.vaadin.flow.router.Route; 10 | import com.vaadin.demo.MainView; 11 | import com.vaadin.flow.component.Tag; 12 | import com.vaadin.flow.component.dependency.JsModule; 13 | import com.vaadin.flow.component.littemplate.LitTemplate; 14 | import com.vaadin.flow.component.template.Id; 15 | 16 | @Route(value = "three-columns", layout = MainView.class) 17 | @PageTitle("Three Columns") 18 | @Tag("three-columns-view") 19 | @JsModule("./src/views/three-columns-view.js") 20 | public class ThreeColumnsView extends LitTemplate { 21 | 22 | @Id("header") 23 | Div header; 24 | 25 | @Id("sidebarLeft") 26 | Div sidebarLeft; 27 | 28 | @Id("sidebarRight") 29 | Div sidebarRight; 30 | 31 | @Id("main") 32 | Div main; 33 | 34 | @Id("footer") 35 | Div footer; 36 | 37 | public ThreeColumnsView() { 38 | header.add(new H1("Header text")); 39 | sidebarLeft.add(new VerticalLayout(new Anchor("", "Link 1"), 40 | new Anchor("", "Link 2"), new Anchor("", "Link 3"), 41 | new Anchor("", "Link 4"))); 42 | sidebarRight.add(new VerticalLayout(new Anchor("", "Link 5"), 43 | new Anchor("", "Link 6"))); 44 | main.add(new Paragraph("Main content goes here.")); 45 | footer.add(new Paragraph("Footer text")); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/TwoColumnsView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.demo.MainView; 4 | import com.vaadin.flow.component.Tag; 5 | import com.vaadin.flow.component.dependency.JsModule; 6 | import com.vaadin.flow.component.html.Anchor; 7 | import com.vaadin.flow.component.html.Div; 8 | import com.vaadin.flow.component.html.H1; 9 | import com.vaadin.flow.component.html.Paragraph; 10 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 11 | import com.vaadin.flow.router.PageTitle; 12 | import com.vaadin.flow.router.Route; 13 | import com.vaadin.flow.component.littemplate.LitTemplate; 14 | import com.vaadin.flow.component.template.Id; 15 | 16 | @Route(value = "two-columns", layout = MainView.class) 17 | @PageTitle("Two Columns") 18 | @Tag("two-columns-view") 19 | @JsModule("./src/views/two-columns-view.js") 20 | public class TwoColumnsView extends LitTemplate { 21 | 22 | @Id("header") 23 | Div header; 24 | 25 | @Id("sidebar") 26 | Div sidebar; 27 | 28 | @Id("main") 29 | Div main; 30 | 31 | @Id("footer") 32 | Div footer; 33 | 34 | public TwoColumnsView() { 35 | header.add(new H1("Header text")); 36 | sidebar.add(new VerticalLayout(new Anchor("", "Link 1"), 37 | new Anchor("", "Link 2"), new Anchor("", "Link 3"), 38 | new Anchor("", "Link 4"))); 39 | main.add(new Paragraph("Main content goes here.")); 40 | footer.add(new Paragraph("Footer text")); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vaadin/demo/views/VerticalExamplesView.java: -------------------------------------------------------------------------------- 1 | package com.vaadin.demo.views; 2 | 3 | import com.vaadin.flow.component.Html; 4 | import com.vaadin.flow.component.Text; 5 | import com.vaadin.flow.component.button.Button; 6 | import com.vaadin.flow.component.button.ButtonVariant; 7 | import com.vaadin.flow.component.html.H2; 8 | import com.vaadin.flow.component.html.H3; 9 | import com.vaadin.flow.component.orderedlayout.VerticalLayout; 10 | import com.vaadin.flow.router.PageTitle; 11 | import com.vaadin.flow.router.Route; 12 | 13 | @Route("vertical") 14 | @PageTitle("VerticalLayout Examples") 15 | public class VerticalExamplesView extends VerticalLayout { 16 | 17 | public VerticalExamplesView() { 18 | setSpacing(true); 19 | setPadding(true); 20 | 21 | add(new H2("Vertical Layout Examples")); 22 | 23 | add(new Text("Each layout has a width of 600px, and a gray background color for better visibility.")); 24 | 25 | category("Margin and Padding"); 26 | 27 | VerticalLayout layout = createLayout("Basic example with default settings"); 28 | layout.add(button("Button one"), button("Button two")); 29 | 30 | layout = createLayout("Basic example without spacing"); 31 | layout.setSpacing(false); 32 | layout.add(button("Button one"), button("Button two")); 33 | 34 | layout = createLayout("Basic example with margins"); 35 | layout.setMargin(true); 36 | layout.add(button("Button one"), button("Button two")); 37 | 38 | layout = createLayout("Basic example with padding"); 39 | layout.setPadding(true); 40 | layout.add(button("Button one"), button("Button two")); 41 | 42 | layout = createLayout("Basic example with margin and padding"); 43 | layout.setPadding(true); 44 | layout.setMargin(true); 45 | layout.add(button("Button one"), button("Button two")); 46 | 47 | category("Scrolling"); 48 | 49 | layout = createLayout("Enable scrolling"); 50 | layout.setPadding(true); 51 | layout.setHeight("300px"); 52 | layout.add(button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), 53 | button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Mushroom"), button("Mushroom")); 54 | layout.getStyle().set("overflow", "scroll");// enable scrolling when content doesn't fit 55 | 56 | layout = createLayout("Partial content scrolling with overflow"); 57 | layout.setPadding(true); 58 | VerticalLayout scrollingLayout = new VerticalLayout(button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), 59 | button("Button"), button("Button"), button("Button"), button("Button"), button("Button"), button("Mushroom"), button("Mushroom")); 60 | scrollingLayout.getStyle().set("background-color", "#eee"); 61 | scrollingLayout.setPadding(false); 62 | scrollingLayout.setMaxHeight("190px"); // restrict the max height 63 | scrollingLayout.getStyle().set("overflow", "scroll"); // enable scrolling when content doesn't fit 64 | Button button = button("Click to add a button"); 65 | button.addClickListener(e -> scrollingLayout.add(button("Contentbutton"))); 66 | layout.add(button, scrollingLayout, button("Footerbutton")); 67 | 68 | category("Size and Positioning"); 69 | 70 | layout = createLayout("Aligning all items"); 71 | layout.setPadding(true); 72 | layout.setAlignItems(Alignment.END); 73 | layout.add(button("Button one"), button("Button two")); 74 | 75 | layout = createLayout("Aligning individual items"); 76 | layout.setPadding(true); 77 | button = button("Align start"); 78 | layout.add(button); 79 | layout.setHorizontalComponentAlignment(Alignment.START, button); 80 | button = button("Align center"); 81 | layout.add(button); 82 | layout.setHorizontalComponentAlignment(Alignment.CENTER, button); 83 | button = button("Align end"); 84 | layout.add(button); 85 | layout.setHorizontalComponentAlignment(Alignment.END, button); 86 | button = button("Strech"); 87 | layout.add(button); 88 | layout.setHorizontalComponentAlignment(Alignment.STRETCH, button); 89 | 90 | layout = createLayout("Expanding one component"); 91 | layout.setPadding(true); 92 | layout.setHeight("300px"); 93 | button = button("Button one"); 94 | layout.add(button, button("Button two")); 95 | layout.setFlexGrow(1, button); // this expands the button 96 | 97 | layout = createLayout("Expanding both components"); 98 | layout.setPadding(true); 99 | layout.addAndExpand(button("Button one"), button("Button two")); // adds and flex-grows both components 100 | // setHeight needs to be defined last because of 101 | // https://github.com/vaadin/vaadin-ordered-layout-flow/issues/134 102 | layout.setHeight("300px"); 103 | 104 | layout = createLayout("Split positioning (without expanding either component)"); 105 | layout.setPadding(true); 106 | layout.setHeight("300px"); 107 | button = button("Button two"); 108 | button.getStyle().set("margin-top", "auto"); // expands the empty space above button two 109 | layout.add(button("Button one"), button); 110 | 111 | layout = createLayout("Advanced split positioning 1"); 112 | layout.setPadding(true); 113 | layout.setHeight("400px"); 114 | button = button("Button two"); 115 | button.getStyle().set("margin-bottom", "auto");// expands the empty space below button two 116 | layout.add(button("Button one"), button, button("Button three")); 117 | 118 | layout = createLayout("Advanced split positioning 2"); 119 | layout.setPadding(true); 120 | layout.setHeight("400px"); 121 | button = button("Button two"); 122 | button.getStyle().set("margin-top", "auto");// expands the empty space above button two 123 | layout.add(button("Button one"), button, button("Button three")); 124 | 125 | } 126 | 127 | private void category(String string) { 128 | add(new H3(string)); 129 | } 130 | 131 | private Button button(String caption) { 132 | Button button = new Button(caption); 133 | button.addThemeVariants(ButtonVariant.LUMO_PRIMARY); 134 | return button; 135 | } 136 | 137 | private VerticalLayout createLayout(String caption) { 138 | VerticalLayout hl = new VerticalLayout(); 139 | hl.setWidth("600px"); 140 | hl.getStyle().set("background-color", "#dddddd"); 141 | add(new Text(caption)); 142 | add(hl); 143 | add(new Html(" ")); // spacer 144 | return hl; 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /src/main/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | org.slf4j.simpleLogger.defaultLogLevel = info 2 | org.slf4j.simpleLogger.log.org.atmosphere = warn 3 | -------------------------------------------------------------------------------- /src/main/webapp/icons/Github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/icons/Github.png -------------------------------------------------------------------------------- /src/main/webapp/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/icons/icon.png -------------------------------------------------------------------------------- /src/main/webapp/images/DataCentricApplicationsWithVaadin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/DataCentricApplicationsWithVaadin.png -------------------------------------------------------------------------------- /src/main/webapp/images/LearningVaadin7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/LearningVaadin7.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin 6.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin 6PreviewEdition.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin 6PreviewEdition.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin 7.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin14.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin7Cookbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin7Cookbook.png -------------------------------------------------------------------------------- /src/main/webapp/images/Vaadin7UIDesignByExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/Vaadin7UIDesignByExample.png -------------------------------------------------------------------------------- /src/main/webapp/images/VaadinPortletStarter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/VaadinPortletStarter.png -------------------------------------------------------------------------------- /src/main/webapp/images/VaadinReceipes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vaadin/layout-examples/343e07c30f3239ca3abaaa4e81f52c13be198a94/src/main/webapp/images/VaadinReceipes.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | // This TypeScript configuration file is generated by vaadin-maven-plugin. 2 | // This is needed for TypeScript compiler to compile your TypeScript code in the project. 3 | // It is recommended to commit this file to the VCS. 4 | // You might want to change the configurations to fit your preferences 5 | // For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html 6 | { 7 | "_version": "9.1", 8 | "compilerOptions": { 9 | "sourceMap": true, 10 | "jsx": "react-jsx", 11 | "inlineSources": true, 12 | "module": "esNext", 13 | "target": "es2022", 14 | "moduleResolution": "bundler", 15 | "strict": true, 16 | "skipLibCheck": true, 17 | "noFallthroughCasesInSwitch": true, 18 | "noImplicitReturns": true, 19 | "noImplicitAny": true, 20 | "noImplicitThis": true, 21 | "noUnusedLocals": false, 22 | "noUnusedParameters": false, 23 | "experimentalDecorators": true, 24 | "useDefineForClassFields": false, 25 | "baseUrl": "src/main/frontend", 26 | "paths": { 27 | "@vaadin/flow-frontend": ["generated/jar-resources"], 28 | "@vaadin/flow-frontend/*": ["generated/jar-resources/*"], 29 | "Frontend/*": ["*"] 30 | } 31 | }, 32 | "include": [ 33 | "src/main/frontend/**/*", 34 | "types.d.ts" 35 | ], 36 | "exclude": [ 37 | "src/main/frontend/generated/jar-resources/**" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /types.d.ts: -------------------------------------------------------------------------------- 1 | // This TypeScript modules definition file is generated by vaadin-maven-plugin. 2 | // You can not directly import your different static files into TypeScript, 3 | // This is needed for TypeScript compiler to declare and export as a TypeScript module. 4 | // It is recommended to commit this file to the VCS. 5 | // You might want to change the configurations to fit your preferences 6 | declare module '*.css?inline' { 7 | import type { CSSResultGroup } from 'lit'; 8 | const content: CSSResultGroup; 9 | export default content; 10 | } 11 | 12 | // Allow any CSS Custom Properties 13 | declare module 'csstype' { 14 | interface Properties { 15 | [index: `--${string}`]: any; 16 | } 17 | } 18 | --------------------------------------------------------------------------------