Managing a component's lifecycle
How to create, update or deprecate a component.
When is it time to create a global component?
Creating a new component is discussed during UI Reviews.
What you need to think about:
- Is it really a shortcut for engineers? Will it make their work a lot faster? Eg. inputs have a lot of states to think through, it’s much faster for engineers to use the inputs made available in Murray but a simple card with no interaction is not that interesting to add to Murray as it doesn't take a lot of time to implement.
- Will it help consistency a lot? Is there a good chance it won’t change often?
- Does it apply in all contexts? Can it be made to apply to all contexts in a simple way? If not, it should probably a local component.
At all times, we have to balance consistency with creativity.
How to update a component?
We will consider two types of changes:
- Breaking changes
- Updates
- As an engineer
- As a designer
We consider a breaking change something that will alter the component's instances. Eg. if you change the API definition of a component or change a default value.
All other changes are considered updates.
Updates
Straightforward, make the change and ping @murray_owner on the pull-request.
Breaking changes
If the modification implies a breaking change, two options are available:
- The better way
- Update the component
- Update all instances of the component
- When it's not possible
Ping a Murray owner first to discuss the change.
- Ping a Murray owner first
- Deprecate the existing component
- Document the breaking change and write a migration guide with a link to the new one
- Create new version of the component
We consider a breaking change something that will alter the component's instances. Eg. if you change the <Button> component and as a result the existing mock-ups using <Button> loose their labels, it is a breaking change.
All other changes are considered updates.
Updates
Straightforward, make the change following the Figma contribution guide.
Breaking changes
For a component called <Name>:
- Rename
<Name>to_🚫<Name> - Date/of/DeprecationEg.<Button>becomes_🚫<Button>- 2021-01-15 - Create your new version and call it
<Name> - Move the older version to the “Deprecated” page of our Figma file
- Hit publish & describe the changes you’ve made
- Make sure changes to the components are implemented in code.
How to deprecate a component?
- As an engineer
- As a designer
- Add
@deprecatedto the component's MD description - Add
@deprecatedto the component's JSDoc
If a component is no longer to be used:
- Rename
<Name>to_🚫<Name>- Date/of/Deprecation - Move it to the “Deprecated” page of our Figma file
- Hit publish & describe the changes you’ve made
- Make sure the component is also deprecated in code.