✨ Component library based on our design system ðŸ›
If you are building Custom Applications for the Merchant Center, be sure to check out our documentation
Interactive documentation of UI Kit components can be found in our Storybook
The UI Kit is a set of React components that follows commercetools Design System.
In case you have any questions about or issues with the tools and components provided in this repository, please reach out to our Support team.
Each UI Kit component is published as a single NPM package under the scope @commercetools-uikit
. This is useful if you only need a bunch of React components and do not want to have bigger bundle.
For example:
import PrimaryButton from '@commercetools-uikit/primary-button';
import SpacingsStack from '@commercetools-uikit/spacings-stack';
import { AngleDownIcon } from '@commercetools-uikit/icons';
If you plan to use more components, you can also use some of the preset packages that group multiple packages together. This is useful to reduce the number of dependencies and imports.
For example:
import { PrimaryButton } from '@commercetools-uikit/buttons';
import Spacings from '@commercetools-uikit/spacings';
There is also a preset package that re-exports ALL UI Kit components: @commercetools-frontend/ui-kit
.
This package is also used for backwards compatibility after we started splitting up the components into single packages.
import {
PrimaryButton,
Spacings,
AngleDownIcon,
} from '@commercetools-frontend/ui-kit';
Each UI Kit package comes with some required peer dependencies to be installed by the consumer.
Depending on which UI Kit packages you use, make sure to have the related peer dependencies installed.
Most of the time the required peer dependencies include react
, react-dom
, react-intl
.
A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications.
Design Systems are becoming more and more useful nowadays, as design and technology strive to find a perfect balance between them.
The UI Kit project is the home of commercetools Design System and its implementation in the form of React components.
The package @commercetools-uikit/design-system
exposes the design variables and tokens used to define design rules and constraints for commercetools products.
You will need a postcss-import plugin, and a postcss variable plugin: either postcss-custom-properties or postcss-css-variables would work.
@import '@commercetools-uikit/design-system/materials/custom-properties.css';
.container {
padding: var(--spacing-l);
}
// wherever you process your CSS
postcss([postcssImportPlugin(), postcssCustomProperties()]);
postcss-custom-properties
and importFrom
The css variables can also be injected using postcss-custom-properties, removing the need to import them directly inside your css files.
/* no import required! */
.container {
padding: var(--spacing-l);
}
// wherever you process your CSS
postcss([
postcssCustomProperties({
preserve: false,
importFrom: require.resolve(
'@commercetools-uikit/design-system/materials/custom-properties.css'
),
}),
]);
You can also access the JavaScript variables like this
import { designTokens } from '@commercetools-uikit/design-system';
const primary = designTokens.colorPrimary;
Please look at the
design-tokens.ts
itself to inspect which variables are available.