DocumentationAll ComponentsContact usChangelog

We're recommending the following MCP servers to improve the usage of ZUi-Web with LLMs and coding assistants.

Figma MCP

The figma MCP server can be useful to quickly generate code from designs. See the official documentation on how to setup Figma MCP server.

CEM MCP

With Figma MCP alone, your LLM will not know any details about ZUi-Web components which will result in hallucinated code using not existing components. To provide actual knowledge about ZUi-Web components, we recommend you to use the "CEM MCP" tool. This tool will use the custom-elements.json file that is part of ZUi-Web releases since several years to extract information about available components and their properties, attributes and events and provide those information to the LLMs.

Setup

Add this configuration to your MCP config (the configuration may depend on the actual AI tool you're using):

{
   "mcpServers": {
      "cem": {
         "type": "local",
         "command": "npx",
         "args": [
            "-y",
            "@pwrs/cem",
            "mcp",
            "--package",
            "./node_modules/@zeiss/zui",
         ]
      }
   }
}

Make sure to use at least version 0.9.3 of @pwrs/cem as previous version had issues when being used via NPM. Adjust the --package option and point to the location of the ZUi-Web package. Typically, this is ./node_modules/@zeiss/zui but could be different depending on your node package manager or monorepo setup.

You should then be able to ask the LLM questions like "Which components are available in the @zeiss/zui web component library?". The LLM should also be able to retrieve information about components automatically.

Agents:

The Usage of Agents with some more infomation how to use the components improved the usage of the cem mcp and the figma mcp server.

example agent for the usage in Angular:

# Custom Agent for Integrating Web Components
## Task Overview

You are a custom agent responsible for integrating web components effectively. Follow these structured steps to ensure accurate implementation and usage.

## Steps to Complete the Task
1. **Information Gathering**:
   - Always utilize the **CEM MCP** (Component Ecosystem Management Master Control Panel) to gather comprehensive information about web components. This includes understanding their functionality and requirements.
   - Specifically, use **CEM MCP** to extract details regarding the component's **API**, **events**, and **properties**.

2. **Data Source Limitation**:
   - Rely solely on **CEM MCP** for information. Do not scan the workspace or use any other sources for gathering data.

3. **Understanding Types**:
   - Look for the **expandedType** field in the **CEM MCP** response to identify the types of properties and events associated with the web components.

4. **File Path Conversion**:
   - When referencing component source files from `custom-elements.json`, convert paths from `src/components/xyz.ts` to the corresponding relative path in `dist/components/xyz.js`. Use these relative paths to locate JavaScript files for examples and implementation details.

5. **Code Creation**:
   - Always refer to the examples in the source files to understand how to utilize the component and its API. Gather insights regarding expected behavior and usage patterns.

6. **Icon Slots**:
   - For components with icon slots, use **zui-icons** from the `@zeiss-/zui-icons` package to fill these slots. Ensure that the icons are imported from the package in your code.

7. **Font Management**:

   - Font files can be found in the `public/fonts` folder, while related CSS font properties are located in `dist/styles/font`. The names of the font files match those defined in Figma, allowing you to find corresponding font files and CSS properties easily.
   - **Note**: It is not necessary to set fonts on the ZUI components.

8. **Design Tokens**:
   - Use the naming convention from Figma to find corresponding CSS properties and values for design tokens. For example, the Figma token `sys/light/bg/1st-default/enabled` translates to `--zui-semantic-sys--bg--1st-default--enabled` in CSS.

9. **Property Matching**:
   - When implementing a component from Figma, verify if the options/properties (e.g., Emphasis, Size, State) defined in Figma correspond to the properties of the ZUI component (e.g., `zui-button`'s emphasis property).
     - If there is a direct match, set the ZUI component property accordingly (e.g., `<zui-button emphasis='highlight'>` if Figma Emphasis is 'highlight').
     - If a Figma property does not have a direct match in the ZUI component, print a note specifying which Figma property and ZUI property do not correspond.

10. **CSS Custom Properties**:
- When a ZUI component provides a CSS custom property for a style (e.g., `--zui-button-width` for width), always use the custom property instead of direct CSS styles.
- If no CSS custom property exists for a style (as verified in the component manifest), set the style using standard CSS (e.g., `style="width:360px;"`).

11. **API Verification**:
    - When asked about using ZUI components, always check their API and ensure correct usage according to the examples referenced in step 5.

12. **Component Usage**:
    - when implementing a figma design with different components try to find the matching zui-component based on naming or the description of the component. If you are not sure about the component to use, ask for clarification or provide a note about the uncertainty.

Limitations

There are some limitations to this approach.

  1. Even though we provide the custom-elements.json file for a long time, the file may lack some information. For example, it could be the case that some properties are missing due to limitations in the tools we're using to generate this file. As always, when it comes to AI: Please verify everything the LLM is doing.
  2. Both MCP and LLMs are still quite a new technique and this is even more true to more niche tools like the @pwrs/cem tool. We as ZUi-Web team have only limited capacity in supporting you with these kind of tools. However, we encourage you to try out these tools and share your experiences, either in our dev-sync meetings or in our teams channels.

Especially, if you have additional recommendations for (MCP) tools that are useful for web components libraries, you should share those with the ZUi-Web community.