If every component we built were to go straight into the UI Kit it would become unmanagable. We should be selective about what components deserve their place in the UI Kit. If you're considering adding a component, here are some questions you should ask.
If you've only used a component once it's difficult to foresee how re-usable it is. If this is the case it probably doesn't belong in the UI Kit yet.
Even if you have used a component multiple times in the app, it's possible that your component is so specific to the contexts it's been used that it would be hard for other developers to re-use it. A <Button />
can be used anywhere but an <AddWidgetButtonWithSparkleEffects />
has limited re-use.
This is a UI Kit. We don't care about state management here. If your component has any side effects or reliance on the business logic of our app it should stay where it is.
Our main app has the UI Kit as a dependency, we do not want it to be a two-way dependency. If your component renders other components that haven't yet been moved to the UI Kit consider either moving those components in first or changing the component so it doesn't rely on them.
If your component is found in multiple parts of the app, is generic enough to be reused in multiple features/contexts, doesn't contain any business logic and doesn't render any components that aren't in the UI Kit then it's time to start planning how to add it.
Here's our guide to migrating an existing component to the UI Kit