Getting started
Installation
npm install @canonical/maas-react-components
or using yarn:
yarn add @canonical/maas-react-components
Add styles import to your app:
@import "@canonical/maas-react-components/dist/style.css";
Development with maas-react-components
To see the changes you make to maas-react-components
reflected in a consuming app immediately, follow these steps:
-
In the maas-react-components
directory, run the following command to create a symlink:
yarn link
-
In the consuming repository (e.g., maas-ui
), run the following command to use the local version of maas-react-components
:
yarn link "@canonical/maas-react-components"
-
Go back to maas-react-components
directory and run the following command to start the build process with the watch flag:
npm run build:watch
-
As you make changes to maas-react-components
they will be automatically built and reflected in the consuming app.
Creating a new component
Make sure to read our React Components Guidelines before you proceed.
Run the following command from the root of the project:
npm run create-component
The script will prompt you to enter details of the new component.
It will create a new directory and files based on the details you provided. New files will contain a basic setup for your new component, including a basic test and a storybook story.