> For the complete documentation index, see [llms.txt](https://ispectra.gitbook.io/mutamad/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ispectra.gitbook.io/mutamad/site-building/theme-and-components.md). Agents can also search and read this documentation through its [MCP server](https://ispectra.gitbook.io/mutamad/~gitbook/mcp).

# Theme and components

The Mutamad theme — every DGA component, Arabic first, with nothing from a CDN.

`mutamad_theme` is the front end: **Bootstrap 5** in Mutamad's greens (`#1B8354`, also DGA's primary), Arabic first and right to left, with the components editors build pages from in Canvas.

<figure><img src="https://171036656-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQSekKpxOCXC1q6G2NRy9%2Fuploads%2Fgit-blob-239e7cddcf821974d2173f94166683af88b726a2%2Fstamp-open-ar.jpg?alt=media" alt="DGA&#x27;s Digital Stamp, open, in Arabic"><figcaption><p>DGA's Digital Stamp, shown above the header of every page.</p></figcaption></figure>

## At a glance

|                   |                                                                                               |
| ----------------- | --------------------------------------------------------------------------------------------- |
| **Components**    | 130 single-directory components; 64 of them in the Canvas library                             |
| **DGA coverage**  | Every component of DGA's Figma library, rebuilt with DGA's own values, and the page templates |
| **Assets**        | Bootstrap, icons and the font are the theme's own files: no CDN                               |
| **Font**          | IBM Plex Sans Arabic, DGA's typeface (SIL Open Font License)                                  |
| **Icons**         | Hugeicons Free (MIT), the stroke set DGA uses                                                 |
| **Direction**     | CSS logical properties, plus RTLCSS for the rest                                              |
| **Accessibility** | WCAG 2.1 AA, tested with axe on every story                                                   |
| **Tests**         | Storybook stories for every component; Playwright tests                                       |
| **Starterkit**    | Generate your own theme from it                                                               |

## The Canvas library

Grouped as **Content**, **Layout**, **Cards**, **Hero** and **Navigation**. Highlights:

| DGA component                                                                 | Notes                                                                                                                                                    |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Digital Stamp                                                                 | On every page, above the header, in the page's language; set once in theme settings                                                                      |
| Table of Content, Metric, Tooltip, Modal                                      | Editor components                                                                                                                                        |
| Content Switcher, Rating, Switch                                              |                                                                                                                                                          |
| Notification, Toast, Inline Alert                                             | Drupal's messages appear as DGA's Inline Alert, confirmations as its Toast                                                                               |
| Charts                                                                        | Drawn on the server as SVG: they show without JavaScript, print, and load nothing from elsewhere. Colours chosen to stay apart for colour-blind readers. |
| File Upload, Date Picker, Step Indicator, Slider, Search Box                  | On Drupal's own fields; each works without JavaScript                                                                                                    |
| Radial Stepper, Skeleton, Floating Button, Code Snippet, Avatar, Progress Bar |                                                                                                                                                          |
| Accessibility Tools                                                           | In the footer: text size and high contrast                                                                                                               |
| Slide-out phone menu, section menu                                            | DGA's mobile drawer and second-level navigation                                                                                                          |

## Patterns

Twelve ready-made sections of a Saudi government home page — hero banner, about, e-services, features, key figures, standards, call to action, latest news, FAQ and more — that editors drop into a page.

## Page templates

| Template      | Holds                                            | Used by                   |
| ------------- | ------------------------------------------------ | ------------------------- |
| **Default**   | Header, breadcrumb, page title, content, footer  | Most pages                |
| **Full page** | Header, content, footer — no breadcrumb or title | Home page, Page not found |

The header and footer are edited in Canvas by the App Admin.

## Images

Every image a visitor sees goes through **drimage**: sized to the box it is shown in, cropped around its focal point, served as WebP. Images placed in Canvas get the same treatment through `mutamad_drimage`.

## Customising the look

{% tabs %}
{% tab title="Change content, not code" %}
Most changes need no code: the header, footer, home page and patterns are all edited in Canvas.
{% endtab %}

{% tab title="Generate a sub-theme" %}
Generate your entity's own theme from Mutamad's starterkit:

```bash
php web/core/scripts/drupal generate-theme my_entity_theme \
  --starterkit mutamad_theme --path themes/custom
```

Then make it the default theme, and point Storybook at it with `STORYBOOK_THEME`.
{% endtab %}

{% tab title="Develop components" %}
On a development site:

```bash
ddev storybook init    # Storybook module, permission, CORS, stories' JSON
ddev storybook start   # https://<site>.ddev.site:6006
ddev storybook gen     # after changing a component's stories
ddev storybook build   # a static Storybook in storybook-static/
ddev storybook disable # turn it off again
```

Storybook renders each component through the site, in English and Arabic, with an accessibility check per story. It runs under DDEV only, never on a public site.
{% endtab %}
{% endtabs %}

## Rules the theme keeps

* No component lets an editor put script on a page (no HTML-code component).
* Nothing loads from another site.
* Every colour pairing meets WCAG 2.1 AA contrast.
* Links are told apart from text by more than colour.
