Skip to content

6. Styling & Theming

MontiGem uses SCSS for styling.

6.1 Component Styles

Create a .scss file with the same name as your .gui file in the same directory (e.g., CarOverview.scss). Styles defined here are scoped to the component.

6.2 Targeting Components

Assign an identifier to a component instance in the GUI model to style it specifically.

Model:

primaryButton@GemButton(label="Save");

SCSS: The identifier becomes a CSS class.

.primaryButton .gem-button {
  background-color: green;
  color: white;
}

6.3 Deep Styling

To style elements inside a child component (e.g., inside a GemCard), you often need to pierce Angular's view encapsulation using ::ng-deep.

:host ::ng-deep .gem-card-title {
  color: blue;
}

6.4 Mixins vs. Extend

Due to Angular's View Encapsulation, using @extend to inherit from global classes defined in styles.scss often fails or produces unexpected results. * Best Practice: Use SCSS Mixins (@mixin / @include) defined in a shared file (e.g., _mixins.scss) and import them in each component where needed.

6.5 GUI Design Patterns

For best practices on structuring your GUI and applying styles consistently, see GUI Design Patterns.


< Previous: RTE & Synchronization | Back to Index | Next: Backend Customization >