You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/usage.mdx
+51-4Lines changed: 51 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,58 @@ The IATI Design System is intended to increase the visual consistency of the IAT
9
9
10
10
It is continuously being updated. If, when updating a website to use the design system, you find that an important question is unanswered, open a GitHub issue to discuss. In the meantime, continue to use your best judgement for the task at hand.
11
11
12
-
After completing the <ahref="../?path=/docs/installation--docs">installation</a> instructions, core styles, such as typography, should be applied to your site.
12
+
## Enable the Design System
13
13
14
-
This Storybook shows the components available in the design system.
15
-
For each component, the **Docs** page shows available variants of the component, like the example shown below for the default variant of the Button component.
14
+
After completing the <ahref="../?path=/docs/installation--docs">installation</a> instructions,
15
+
you must enable the design system styles, by applying the `.iati-design-system--enabled` class on the `<body>` element of your page.
16
+
This will apply core styles, such as typography, to the site, and enable you to use components from the design system.
16
17
17
-
Click on **Show code** in the bottom right to see the HTML elements and classes being used and apply them to your own site.
18
+
```html
19
+
<bodyclass="iati-design-system--enabled">
20
+
<!-- The rest of your page content -->
21
+
</body>
22
+
```
23
+
24
+
## Using Components
25
+
26
+
This Storybook site shows all the components available in the design system.
27
+
For each component, the **"Docs"** page shows available variants of the component.
28
+
29
+
Click on **Show code** in the bottom right to see a HTML snippet which shows which CSS classes to use.
30
+
For example, the snippet for the example below shows us that the `.iati-button` class has been applied to a `<button>` element.
18
31
19
32
<Canvasof={ButtonStories.Default} />
33
+
34
+
## Incremental Migration
35
+
36
+
For larger projects migrating to the IATI Design System, it can be useful to roll-out the styles incrementally instead of globally, to avoid clashes with existing styles.
37
+
38
+
To support this this, instead of appling the `.iati-design-system--enabled` class to the `<body>` element,
39
+
it is possible to wrap any section of the page in a container with the `.iati-design-system--enabled` class,
40
+
so that the IATI Design System styles are only applied to that section.
41
+
This can be used on large components like the Header or for smaller elements like a Button.
42
+
43
+
### Example
44
+
45
+
The following code shows how to apply the IATI Design System to the header and footer,
46
+
leaving the rest of the page as-is:
47
+
48
+
For a working example, see the <ahref="/?path=/story/layout-page--incremental-migration">Incremental Migration story</a>.
0 commit comments