|
| 1 | +# Foundation |
| 2 | + |
| 3 | +The library also provides styles for SGDS foundation to help users style your application wholistically with SGDS. |
| 4 | +The styles help to override the default browser's native styles with SGDS. |
| 5 | + |
| 6 | +These files are distributed as CSS files and are optional to import. These styles do not affect the web components and are not required in the web component. |
| 7 | +However, do note that the CSS styles the light dom and may causes clash of styles if there are other styling libraries (for example, tailwind, bootstrap, sgds v1 and v2 css, etc.) used in your app. |
| 8 | + |
| 9 | +Foundation aspects of SGDS includes: |
| 10 | + - typography, |
| 11 | + - body `<body>` |
| 12 | + - paragraphs `<p>` |
| 13 | + - labels `<label>` |
| 14 | + - anchor `<a>` |
| 15 | + - captions `<caption>` |
| 16 | + - headers `<h1>, <h2>, <h3>, <h4>, <h5>, <h6>` |
| 17 | + - list `<ol>, <ul>, <li>` |
| 18 | + - grid system <sgds-badge show>work in progress</sgds-badge> |
| 19 | + |
| 20 | +## Import |
| 21 | + |
| 22 | +The CSS styles are dependent on the css variable tokens. Import the `themes/day.css` file first before importing the css files. If you required night mode, import `themes/night.css` as well. |
| 23 | +The colors assigned to elements and class selectors will switch depending on day or night mode. |
| 24 | + |
| 25 | +<strong>JS imports</strong> |
| 26 | + |
| 27 | +```js |
| 28 | +import "@govtechsg/sgds-web-component/themes/day.css" |
| 29 | +//optional: if you are doing night mode |
| 30 | +import "@govtechsg/sgds-web-component/themes/night.css" |
| 31 | +import "@govtechsg/sgds-web-component/css/sgds.css" |
| 32 | + |
| 33 | +``` |
| 34 | + |
| 35 | +<strong>CSS imports</strong> |
| 36 | + |
| 37 | +```css |
| 38 | +@import "@govtechsg/sgds-web-component/themes/day.css"; |
| 39 | +/** optional: if you are doing night mode */ |
| 40 | +@import "@govtechsg/sgds-web-component/themes/night.css"; |
| 41 | +@import "@govtechsg/sgds-web-component/css/sgds.css"; |
| 42 | +``` |
| 43 | + |
| 44 | +### Cherry pick the styles |
| 45 | + |
| 46 | +`css/sgds.css` contains all the stylings found in the folder `css`. You can also choose to cherry pick the styles you required. For example, `label.css` |
| 47 | + |
| 48 | +<strong>JS imports</strong> |
| 49 | + |
| 50 | +```js |
| 51 | +import "@govtechsg/sgds-web-component/themes/day.css" |
| 52 | +//optional: if you are doing night mode |
| 53 | +import "@govtechsg/sgds-web-component/themes/night.css" |
| 54 | +import "@govtechsg/sgds-web-component/css/label.css" |
| 55 | + |
| 56 | +``` |
| 57 | + |
| 58 | +<strong>CSS imports</strong> |
| 59 | + |
| 60 | +```css |
| 61 | +@import "@govtechsg/sgds-web-component/themes/day.css"; |
| 62 | +/** optional: if you are doing night mode */ |
| 63 | +@import "@govtechsg/sgds-web-component/themes/night.css"; |
| 64 | +@import "@govtechsg/sgds-web-component/css/label.css"; |
| 65 | +``` |
| 66 | + |
| 67 | +## Source files |
| 68 | + |
| 69 | +<iframe |
| 70 | + src='https://gist.github.com/clukhei/a31bfc0ea0c2b87d950b125f92835a76.pibb' |
| 71 | + style="width: 100%; height: 1000px; border: 0;" |
| 72 | +> |
| 73 | +</iframe> |
0 commit comments