npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@opengovsg/design-system-react

v1.35.1

Published

React components

Readme

@opengovsg/design-system-react

This design system extends from the wonderful Chakra UI library.

The available components can be viewed at our Storybook

Installing the design system

ChakraUI is a peer dependency of this design system and should be installed alongside this package. The full list of peer dependencies can be found in the package.json.

(You might find that you do not need to install some peer dependencies until you need them.)

$ npm install --save @opengovsg/design-system-react @chakra-ui/react
# or
$ yarn add @opengovsg/design-system-react @chakra-ui/react

Getting set up

To start using the components, please follow these steps:

  1. Wrap your application in a ThemeProvider provided by @opengovsg/design-system-react.

There is also an optional (though strongly recommended) font package inter-ui that provides the font that is used throughout the design system. If using code fonts, the IBM Plex Mono package is also recommended.

This CSS file(s) should be imported in the root of your application once:

import 'inter-ui/inter.css' // Strongly recommended.
import '@fontsource/ibm-plex-mono' // Import if using code textStyles.

import { ThemeProvider } from '@opengovsg/design-system-react'

const App = ({ children }) => (
  <ThemeProvider>
    <ColorModeProvider>{children}</ColorModeProvider>
  </ThemeProvider>
)

ColorModeProvider is a context that provides light mode and dark mode values to the components. It also comes with a function to toggle between light/dark mode.

However, this design system current does not support dark mode for now, and as such do not recommend using ColorModeProvider.

  1. Now you can start using components like so:
import { Button } from '@opengovsg/design-system-react'

const App = () => <Button>Click me</Button>

This design system does not provide the full range of components that ChakraUI provides. As such, consume components from the Chakra UI library as needed. They should work in synergy.

import { Box } from '@chakra-ui/react'
import { Button } from '@opengovsg/design-system-react'

const Example = () => (
  <Box>
    <Button>Will work side by side with ChakraUI</Button>
  </Box>
)

Adding types for TypeScript

Using @chakra-ui/cli, you can also generate types for the design system to provide autocomplete for your TypeScript code.

If you are extending the theme (you used extendTheme):

npx @chakra-ui/cli tokens <path/to/your/theme.(js|ts)>

If generating for the base design system:

npx chakra-cli tokens node_modules/@opengovsg/design-system-react/build/main/theme/theme.js

Note 🚨: If you delete the node_modules directory, you'll need to re-run the command to get proper typings again.

For convenience, you can add a postinstall script to your package.json, so you don't have to think about this every time you re-install your dependencies.

"scripts": {
  "gen:theme-typings": "chakra-cli tokens node_modules/@opengovsg/design-system-react/build/main/theme/theme.js",
  "postinstall": "npm run gen:theme-typings"
}

Common problems


### I am seeing

```bash
Module not found: Can't resolve 'libphonenumber-js/examples.mobile.json'

libphonenumber-js is a peer dependency of this design system, and version 8 is automatically installed if your npm version is >= 7

If you're on npm version 4 to 6, install libphonenumber-js explicitly by executing the following command.

$ npm install libphonenumber-js

I am seeing

When running your build script with tsc:

./../node_modules/@chakra-ui/theme/dist/index.d.ts:1636:25 - error TS2411: Property '_dark' of type 'undefined' is not assignable to 'string' index type 'string'.

1636                         _dark?: undefined;
                             ~~~~~

../../node_modules/@chakra-ui/theme/dist/index.d.ts:1637:25 - error TS2411: Property 'opacity' of type 'undefined' is not assignable to 'string' index type 'string'.

1637                         opacity?: undefined;
                             ~~~~~~~

../../node_modules/@chakra-ui/theme/dist/index.d.ts:1638:25 - error TS2411: Property 'cursor' of type 'undefined' is not assignable to 'string' index type 'string'.

1638                         cursor?: undefined;
                             ~~~~~~

To fix this, ensure that skipLibCheck is set to false in your tsconfig.json

Publishing a new version

Releases use Changesets, following OUI's release workflow. Run commands from the repository root.

For each user-facing change, run npm run changeset, select @opengovsg/design-system-react, choose a patch, minor, or major bump, and write a short release note. Commit the generated .changeset/*.md file with your change. Documentation and tooling-only changes do not need a changeset.

After changes merge to main, the Publish (Camp) workflow opens or updates a release PR with the package version, changelog, and root package-lock.json. Review and merge that PR to build and publish to npm (latest) and GitHub Packages, and create a GitHub release. Already published versions are skipped, so a failed GitHub Packages publish can be retried by rerunning the workflow. The token generator is private and is never published.

For a test release, manually run Publish (Camp) on main with Create snapshot release enabled. Pending changesets are released under the snapshot tag in both registries, without committing version changes or consuming the changesets on main. A snapshot requires a pending changeset. Install it with npm install @opengovsg/design-system-react@snapshot.

The former alpha, beta, and latest branch publishing workflow is retired; use release PRs and snapshots instead of npm version, manual tags, or merging release branches back into main.

Repository setup

  • Enable Allow GitHub Actions to create and approve pull requests in Settings → Actions → General. The workflow uses GITHUB_TOKEN to create release PRs, tags, releases, and publish to GitHub Packages.
  • Keep npm trusted publishing configured for opengovsg/camp-design-system and .github/workflows/publish-camp.yml. The workflow uses npm 11 with OIDC; no npm publishing token is needed.
  • If required checks do not run on a bot-created release PR, close and reopen the PR to trigger them before merging.

Further reading

As this design system is built on top of ChakraUI, it is (hopefully) fully compatible with ChakraUI's usage. Read ChakraUI's documentation for all the available props and usage examples.