Skip to content

Stying with CSS

Xtensio supports multiple ways of handling CSS, including:

  1. CSS/SCSS modules
  2. Global CSS

CSS/SCSS modules

Xtensio has built-in support for CSS/CSS Modules using the .module.(s)css extension.

CSS Modules scope CSS locally by generating unique class names, allowing the same class names in different files without conflicts—ideal for component-level styling.

Example using css modules in a popup

/popup/popup.jsx
1
2
3
4
5
6
7
import styles from './popup.module.css'

const PopupPage = () => {
  return <div className={styles.hugeText}>This is the extension popup</div>;
};

export default PopupPage;
/popup/popup.module.css
1
2
3
.hugeText {
    font-size: 32px;
}

/popup/popup.tsx
1
2
3
4
5
6
7
import styles from './popup.module.css'

const PopupPage: React.FC = () => {
  return <div className={styles.hugeText}>This is the extension popup</div>;
};

export default PopupPage;
/popup/popup.module.css
1
2
3
.hugeText {
    font-size: 32px;
}

Global CSS

Any .css file imported at any location of the project is currently treated as global CSS.

Example way of using global css

import "./some-css-file.css";
// ...

And that' it! you've included some global CSS to your project