Skip to main content
Skip table of contents

SCSS Style Guide

There are three ways to apply Style to the UI Component.

1. Changing the value in the Property screen

2. Applying line style or sx prop(mui style)

line style

  1. To style an element with the inline style attribute, the value must be a JavaScript object.

    CODE
    <Box style={{ width: 100, height: 100 }}>
    </Box>

sx prop

3. Applying SCSS Style

The example for applying SCSS style is as follows.

Info.

When dragging and dropping the UI Component from the Component Palette, import styles from "./assets/styles/styles.scss" code is automatically added above.

  • Step 1. Add CSS class in your styles.scss file.

  • Step 2. Import style files as modules in your tsx file(e.g. index.tsx).

  • Step 3. In JSX code, add the className property to apply SCSS classes in your div tag.

image-20241024-021537.png

assets/styles/styles.scss

CODE
.main-header {
  width: 100%;
  height: 100%;
}

.container-sample {
  padding: 20px;
  background-color: aqua;
}

index.tsx

CODE
import styles from "./assets/styles/styles.scss";

...

render() {
  return (
      <ThemeProvider theme={this.systemTheme}>
          <div className={styles["container-sample"]}>
          </div>
      </ThemeProvider>
  );
}

Note. General SCSS Coding Guideline

Developers should be cautious when changing styles for tags such a html, body, and img in their SCSS files.
This can critically impact the overall system’s styling, so it is recommended to apply styles using class selectors.
We will be updating the CSS style development guide soon. Additionally, we are currently developing a method to block such issues right before the build.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.