This project stops short of being a full design system and instead focuses on providing usable components that are informed by the UNDRR brand guidelines and project styles.
These components offer consistency, documentation, and portability to speed up quality development with the expected look and feel. They also help reduce entropy, which is critical to ensuring websites remain accessible.
If there is a Component or Pattern that you need, or you have any other feedback, question, or comment, please contact us in the issue queue.
→ View the complete getting started guide for detailed integration instructions, code examples, and best practices.
Install Mangrove as an npm or yarn dependency (https://www.npmjs.com/package/@undrr/undrr-mangrove):
# NPM
npm install @undrr/undrr-mangrove
# Yarn
yarn add @undrr/undrr-mangroveThe package includes:
- Compiled React components for dynamic applications
- CSS files for styling (base and theme variants)
- JavaScript files for interactive functionality
- Sass source files for custom theming
- Explore the contents: https://www.npmjs.com/package/@undrr/undrr-mangrove?activeTab=code
You can use the provided npm scripts to simplify running commands inside Docker containers. These scripts are defined in the package.json file and can be run using yarn.
For detailed development setup and workflow instructions, see the Development Guide.
The project uses the following branching strategy:
mainis the primary branch and all commits to it are automatically deployed to the GitHub Pages website- Development work should be done on feature branches
- Pull requests should be opened against
mainand should reference either:- An internal GitLab issue
- A public GitHub issue
For production use:
- Stable releases are published as tagged releases on GitHub and on npm
- The
devbranch is not used
When creating a new feature or fix:
- Create a new branch from
main - Make your changes
- Open a pull request against
main - Reference the relevant issue from Github or the private UNDRR GitLab
- Once approved, the changes will be merged and automatically deployed
# Start the application: brings up Docker containers, installs dependencies, and runs Storybook locally on port 6006
yarn docker-run
# Install project dependencies inside the Docker container
yarn docker-install
# Build the project for release inside the Docker container
yarn docker-build
# Watch for component changes and rebuild (inside Docker)
yarn docker-watch
# Watch for component changes and rebuild (direct)
yarn watch
# Lint the codebase inside the Docker container
yarn docker-lintYou can use the provided Makefile to simplify running commands inside Docker containers. Run the following commands to create/update the codebase:
# Start the application, runs Storybook locally via port 6006
make up
# Install project dependencies
make install
# Run Storybook locally
make run
# Lint the codebase
make lint
# Watch for component changes and rebuild
make watch
# Build for release (default mode is production, you can override it with --mode=development)
make buildIf you prefer running Docker commands manually, the following commands are available:
# Clone the codebase
git clone git@github.com:unisdr/undrr-mangrove.git
cd undrr-mangrove
# Start the application, runs Storybook locally via port 6006
docker-compose up -d
# Install project dependencies
docker exec -it undrr-mangrove-client-1 bash -c "yarn install"
# Run Storybook locally
docker exec -it undrr-mangrove-client-1 bash -c "yarn run storybook --ci"
# Watch for component changes and rebuild
docker exec -it undrr-mangrove-client-1 bash -c "yarn run watch"
# Build the project for release (default mode is production)
docker exec -it undrr-mangrove-client-1 bash -c "yarn run build"
# Lint the codebase
docker exec -it undrr-mangrove-client-1 bash -c "yarn run lint"For detailed release procedures and versioning information, see the Release Process Guide.
When adding new components, we rely on the Jest library to test the library. Jest is a JavaScript testing framework that is easy to use and provides a variety of features for testing React components.
For comprehensive testing guidelines and procedures, see the Testing Guide.
This project uses Chromatic for visual regression testing. Chromatic automatically captures screenshots of your stories and compares them against previous versions to detect visual changes.
The Chromatic workflow executes automatically:
- On pushes to
mainordevelopbranches - On pull requests targeting
mainordevelop - Only when relevant files change:
- Stories (
stories/**) - Storybook configuration (
.storybook/**) - Package configuration (
package.json,*.config.js) - The workflow file itself
- Stories (
-
Pull Request Comments: Chromatic automatically adds a comment to PRs with:
- Link to the visual review
- Summary of changes detected
- Build status
-
GitHub Actions: Check the "Chromatic Visual Testing" workflow run for:
- Build logs
- Direct link to Chromatic build
-
Chromatic Dashboard: Visit the build link to:
- Review visual changes side-by-side
- Accept or reject changes
- Leave comments for reviewers
- View component history
To skip Chromatic for a specific commit, include [skip chromatic] in your commit message:
git commit -m "chore: update dependencies [skip chromatic]"Note: Visual changes on the main branch are automatically accepted as the new baseline.
To create tests for your component library, you can create files in the stories/__tests__ folder. Jest will automatically discover and run any files in this folder that end in .test.js.
Each test file should contain one or more test cases. A test case is a function that takes two arguments: a test description and a callback function. The callback function is where you will write your test code.
The test code should assert that the component behaves as expected. You can use the Jest assertion library to do this. The Jest assertion library provides a variety of functions for asserting different types of values.
To run your tests, you can use the following command:
yarn testTo run the test coverage report, you can use:
yarn test:coverageCompiled assets are available via npm (@undrr/undrr-mangrove) and the UNDRR CDN. The dist directory contains:
dist/components/: compiled React component ES modules (e.g.,ShareButtons.js)dist/css/: compiled theme stylesheetsdist/js/: vanilla JS utilities
The build generates static JSON files with component metadata so AI coding agents can look up Mangrove components without parsing the Storybook SPA. After deploy, these are available at:
llms.txt-- project summary and conventionsai-components/index.json-- all components with names, imports, and links to detail filesai-components/{id}.json-- per-component props, types, defaults, and code examples
See the AI and MCP integration guide for details on directing agents to Mangrove and configuring Claude Code, Cursor, or Copilot.
For contributing to this library:
- Development Guide - Setup, workflow, and coding standards
- Storybook developer docs - Interactive component documentation and usage examples
- Testing Guide - Unit, visual, and accessibility testing
- Release Process - Versioning and publishing
@undrr/undrr-mangrove/
├── components/ # React components
├── css/ # Compiled CSS files
├── js/ # Compiled JavaScript files
└── scss/ # Component stories (SCSS only)
For CDN and static asset hosting in the UNDRR Static assets repo. The primary use case for this feature is static sites with no build process.
All assets are now served from versioned endpoints for stability:
https://assets.undrr.org/static/sitemap.html#mangrove-1-2-10
https://assets.undrr.org/static/mangrove/README.md
https://assets.undrr.org/static/mangrove/latest/css/style.css
https://assets.undrr.org/static/mangrove/latest/components/MegaMenu.js
https://assets.undrr.org/static/mangrove/latest/js/tabs.js
https://assets.undrr.org/static/mangrove/1.3.3/css/style.css
https://assets.undrr.org/static/mangrove/1.3.3/components/MegaMenu.js
https://assets.undrr.org/static/mangrove/1.3.3/js/tabs.js
https://assets.undrr.org/testing/static/sitemap.html#mangrove-1-2-4
https://assets.undrr.org/testing/static/mangrove/latest/css/style.css
https://assets.undrr.org/static/mangrove/1.3.3/css/style.css
... etc
To check the current latest version available on npm:
npm view @undrr/undrr-mangrove version
# or
npm info @undrr/undrr-mangrove versionTo install the latest version:
npm install @undrr/undrr-mangrove@latestTo update all dependencies to their latest semver-compatible versions:
npm outdated
npm updateNote: Production sites should use versioned CDN paths (e.g., /static/mangrove/1.3.3/) for stability. A latest alias is available for testing but may change without notice.
- Developing on Windows: You may encounter some issues when developing directly on Windows (Jest does not seem to run), we suggest you use the Docker container and commands (e.g.
yarn run docker-up) - Preact vs React: After initially planning to use Preact, we've stayed with
react-domfor using the components in other systems. This ensures that the Storybook and other system runtimes remain similar, avoiding issues with React-only components (e.g.react-leaflet). - TypeScript support: While the default implementation uses JSX and JavaScript, TypeScript is fully supported. You can view examples of TypeScript components in the TypeScript Example Component (code location:
stories/Components/TypeScriptExampleComponent)
Components and code are Apache 2.0 licensed. The UNDRR look and feel is proprietary.
The base configuration and bootstrapping of this Storybook-powered library was done based off the UNDP Design System, which is MIT licensed, but done with their kind blessing.