@canonical/maas-react-components
v1.28.1
Published
React components for use in MAAS UI projects.
Downloads
855
Maintainers
Keywords
Readme
MAAS React Components
Library of React components for use in MAAS UI projects.
It contains components that are either specific to, or only used in MAAS. General purpose components should be added to @canonical/react-components instead.
Storybook | Philosophy and guidelines
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 ofmaas-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.