From 0559a96ee29ef31660d9aa1e51a719d7b059e8c2 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Tue, 12 May 2020 12:34:29 +0300 Subject: [PATCH] Docs for theming guide --- src/AppMenu.vue | 8 +- src/components/common/Common.css | 4 - src/views/inputtext/InputTextDemo.vue | 2 +- src/views/inputtext/InputTextDoc.vue | 4 +- src/views/theming/Theming.vue | 109 +++++++++++++++++++++++++- 5 files changed, 113 insertions(+), 14 deletions(-) diff --git a/src/AppMenu.vue b/src/AppMenu.vue index b171ee65b..4f2033676 100755 --- a/src/AppMenu.vue +++ b/src/AppMenu.vue @@ -8,8 +8,9 @@
Get Started Theming - Designer - Sass API + Designer + Sass API + PrimeFlex Icons
@@ -78,7 +79,6 @@ Card Deferred Fieldset - FlexGrid Panel TabView Toolbar @@ -146,7 +146,7 @@ - Multimedia + Image
Galleria diff --git a/src/components/common/Common.css b/src/components/common/Common.css index 4c6afc885..2e876e914 100755 --- a/src/components/common/Common.css +++ b/src/components/common/Common.css @@ -45,10 +45,6 @@ } .p-unselectable-text { - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -o-user-select: none; user-select: none; } diff --git a/src/views/inputtext/InputTextDemo.vue b/src/views/inputtext/InputTextDemo.vue index 563032e90..98fbe07ef 100755 --- a/src/views/inputtext/InputTextDemo.vue +++ b/src/views/inputtext/InputTextDemo.vue @@ -39,7 +39,7 @@

Sizes

- +
diff --git a/src/views/inputtext/InputTextDoc.vue b/src/views/inputtext/InputTextDoc.vue index 156f5d796..299ce149d 100755 --- a/src/views/inputtext/InputTextDoc.vue +++ b/src/views/inputtext/InputTextDoc.vue @@ -42,7 +42,7 @@ import InputText from 'primevue/inputtext'; Note that these classes should be used to change the size of a particular field, for global scaling see the theming page.

<InputText type="text" class="p-inputtext-sm" placeholder="Small" /> -<InputText type="text" class="p-inputtext" placeholder="Normal" /> +<InputText type="text" placeholder="Normal" /> <InputText type="text" class="p-inputtext-lg" placeholder="Large" /> @@ -120,7 +120,7 @@ import InputText from 'primevue/inputtext'; <h3>Sizes</h3> <div class="sizes"> <InputText type="text" class="p-inputtext-sm" placeholder="Small" /> - <InputText type="text" class="p-inputtext" placeholder="Normal" /> + <InputText type="text" placeholder="Normal" /> <InputText type="text" class="p-inputtext-lg" placeholder="Large" /> </div> diff --git a/src/views/theming/Theming.vue b/src/views/theming/Theming.vue index 76e039a90..fc54ecf4a 100755 --- a/src/views/theming/Theming.vue +++ b/src/views/theming/Theming.vue @@ -3,14 +3,28 @@

Theming

-

Choose from a variety of premium themes or develop your own theme using PrimeVue Theme Designer API.

+

Choose from a variety of themes or develop your own theme easily.

-

Theme Designer API

+

Architecture

+

PrimeVue is a design agnostic library so unlike other UI libraries it does not enforce a certain styling such as material or bootstrap. In order to achieve this, styling has been + separated into core and theme. Core resides inside PrimeVue to implement the structure of the components such as positioning whereas theme brings the colors, paddings + and margins.

+ +

Themes

+

PrimeVue offers various free themes and premium themes along with premium templates that provide an application layout as well. All the free themes are built with + the Theme Designer and the npm package brings the CSS output of the theme whereas SCSS is kept as a premium feature + in the designer. This means free themes are open source and for customization with SASS, a designer license needs to be acquired.

+ +

Customization

+

CSS of the themes share the same license as PrimeVue which is MIT, this means the generated CSS can be customized per your needs however this should be avoided if your customizations + are not simple. For instance even to change a primary color, since there is no variable a find and replace should be performed various times. On the other hand, this can be achieved + by changing a single variable e.g. $primaryColor. Visit the SASS API for the documentation of available customization options.

+

Designer API is the ultimate tool to create your own PrimeVue experience powered by a SASS based theme engine - with 500+ variables and a demo application. In addition, PrimeVue only ships the generated CSS of Nova, Luna and Rhea themes whereas Designer provides + with 500+ variables and a demo application. As mentioned before, PrimeVue only ships the generated CSS of Saga, Vela, Nova, Luna and Rhea themes whereas Designer provides full access to the whole SASS structure and the variables of these pre-built themes.

Whether you have your own style guide or just need a custom theme, Designer API is the right tool to design and bring them to existence.

@@ -19,6 +33,95 @@ PrimeVue Designer + +

Scaling

+

PrimeVue utilizes rem units to make sure the components blend in with the rest of your UI perfectly. This also enables scaling, for example changing the size of the components + is easy as configuring the font size of your document. Code below sets the scale of the components based on 16px. If you reqire bigger or smaller component, you may + change this variable and components will resize accordingly.

+ + +html { + font-size: 16px; +} + + +

Some commonly used components such as inputs, buttons and datatable also provide per component scaling with special classes. Components with specific scaling options + are documented in their own documentation.

+ +<InputText type="text" class="p-inputtext-sm" /> +<Button label="Button" class="p-button-lg" /> + + +

Local Styling

+

Theming styles the components globally, in case you required to change the style of a certain component for a specific use case use the class property and override the defaults. + Example below changes the background of the panel. Note that this is only for local styling, if you require to change the background color of all the panel, a custom theme is a far better choice.

+ +<Panel header="Custom Header" class="dark-panel"/> + + + +<style lang="scss" scoped> +/deep/ .dark-panel.p-panel { + .p-panel-titlebar { + background: #212121; + } + +} +</style> + + +

Utility Classes

+

A couple of utility classes are provided as a solution to common requirements.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
p-componentsApplies component theming such as font-family and font-size to an element.
p-disabledApplies an opacity to display as disabled.
p-sr-onlyElement becomes visually hidden however accessibility is still available.
p-resetResets the browsers defaults.
p-linkRenders a button as a link.
p-linkRenders a button as a link.
p-errorApplies the invalid theme color to a text.
p-invalidAlias to p-error.
p-text-secondaryApplies the text color of the theme with the secondary priority.
+
+