Skip to main content
Skip table of contents

SCSS Style Guide

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

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.

1. Applying SCSS Style RECOMMENDED

The example for applying SCSS style is as follows.

Info.

When dragging and dropping the UI Component from the Component Palette, code is automatically added above.

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

    CODE
    .main-header {
      width: 100%;
      height: 100%;
    }
    
    .container-sample {
      padding: 20px;
      background-color: aqua;
    }

  • Step 2. Import style files as modules in your tsx file like below.
    import styles from "./assets/styles/styles.scss"

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

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

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

line style

  • 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

JavaScript errors detected

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

If this problem persists, please contact our support.