SASS
Like Bootstrap 5, SGDS provides style customisation through SASS source files. For advanced use of variables, maps, mixins and functions, please refer to Bootstrap's documentation.
Pre-requisites
You would need to install SASS. Use SASS to customise how SGDS looks and behaves in your project.
Step 1: Local installation
Step 2: Import components
In your custom.scss, you can choose to include all sgds-theme files or pick the components you need. However do note that are some requirements and dependencies across the components as shown in the code snippet in method 2.
Method 1: Import whole SASS library
Code snippet to import the entire SASS library.
Method 2: Import individual SASS component styling file
Below is an example of how you can include parts of SGDS
If you are using Webpack, u can omit the node_modules directory
Step 3: Start building your application
There are ready made components, patterns, layouts and templates to use. You may refer to the components page, patterns page, layouts page or templates page to copy the relevant HTML & CSS code.
Customisation (optional)
You can find the complete list of variables inside @govtechsg/sgds/sass/_variables.scss or in our SGDS github repo
Here's an example that changes the background-color and color for the body when importing and compiling sgds-theme via npm:
Last updated 05 November 2024