-
Notifications
You must be signed in to change notification settings - Fork 317
v4 to v5 upgrade guide
Ivy is here! Angular project has been updated from v7 to v14. Going forward only angular versions v14 and above will be supported and with, we have enabled partial ivy compilation.
- With this change, angular switches from node-sass to sass (dart)
- IE is no longer supported, hence IE specific keys ('Down', 'Esc', 'Up', etc.) & conditions have been removed.
- Peer dependencies now list
@carbon/stylesinstead ofcarbon-componentspackage.- To get started with dart sass, checkout the
@carbon/stylesdocumentations. - All class prefixes within components have been updated from
bx--tocds--, an abbreviation of Carbon Design System.
- To get started with dart sass, checkout the
- You can view the migration guide from
carbon-componentsto@carbon/styleshere.
We have officially deprecated the @carbon/icons-angular package in favor of @carbon/icons. You'll now see a deprecation notice when you run your install scripts.
@carbon/icons is the main icons package for Carbon Design System, hence you'll get updates as soon as they are made. Additionally, the unpacked size is significantly lower, 38MB compared to 148MB.
To get started with @carbon/icons check out the code sandbox demo.
There are comments added to files to guide you through the usage. The relevant files to look at are:
- Carbon 11 aims to add consistency in sizing options for all relevant components. In v4, we offered
sm,md,xl. This has been updated tosm,md,lg. - Form components no longer accepts
xlvalue for size, instead uselg.
Old:
<ibm-date-picker size="xl"></ibm-date-picker>New:
<cds-date-picker size="lg"></cds-date-picker>- All component and directive prefixes have been changed from
ibmtocds. This change is made to better align with carbon-design-system github organization. - We still support
ibmprefix, but we plan on deprecating it before v6. We recommend teams move tocdsprefix for CCA.
Old:
<ibm-date-picker></ibm-date-picker>
<svg ibmIcon="fade" size="16"></svg>New:
<cds-date-picker></cds-date-picker>
<svg cdsIcon="fade" size="16"></svg>-
themeproperty is now deprecated for all relevant component. Instead, we recommend you start start using the new cdsLayer directive to apply light/dark theme.
Old:
<ibm-date-picker theme="light"></ibm-date-picker>
<ibm-select theme="light">...</ibm-select>New:
<!-- The following code will apply `light` theme to all supported components in the div -->
<div cdsLayer>
<cds-date-picker></cds-date-picker>
<cds-select>...</cds-select>
</div>- Dark theme is the default value for the theme property. If you need to set the theme to
dark, you can pass0or2.
<!-- The following code will apply `dark` theme to all supported components in the div -->
<div cdsLayer="0">
<cds-date-picker></cds-date-picker>
<cds-select>...</cds-select>
</div>Components not listed have minimal changes and should not effect your migration.
-
- Added new input properties:
-
disable- prevents accordion item from being expanded. -
size- sets the size of the accordion item.
-
- Template has been updated to remove list items (
ul,li) to provide better accessibility usingrole.
- Added new input properties:
-
-
Button directive has major changes. The directive no longer supports standalone icons, instead use the newly
cds-icon-buttoncomponent. -
cdsButton(Directive)-
sizetypes have been updated to be consistent with other components. We longer supportsfieldvalue, instead usemd. A new size option has also been added2xl. Hence, following size options can now be used:sm,md(default),lg,xl,2xl. -
type(Button type), no longer acceptstoolbar-actionas a value as it was not used in v4. - Button directive no longer supports assistive text (tooltips for icon), hence
hasAssistiveText,assistiveTextPlacement,assistiveTextAlignmentinput properties have been removed, if you use these options switch to Icon button.
-
-
Old: New: <button [iconOnly]="true" [hasAssistiveText]="true" assistiveTextPlacement="top" assistiveTextAlignment="left"> <svg class="bx--btn__icon" ibmIcon="copy" size="16"></svg> <span class="bx--assistive-text">Icon description</span> </button>
<!-- `assistiveTextPlacement` & `assistiveTextAlignment` have been combined to a single input --> <cds-icon-button align="top-left" description="Icon description"> <svg class="cds--btn__icon" cdsIcon="copy" size="16"></svg> </cds-icon-button>
- You can use
alignproperty to set the alignment & placement of the assistive text. - With the changes to tooltip, standalone icon buttons have been separated into a new component. The component covers most of the use cases, but you may need to create a custom icon button. To do so, a
BaseIconButtoncomponent has been created to help you get started. - You will be able to pass in attributes &
globalclasses, see storybook & docs for examples.
- You can use
-
-
-
CheckboxChangeclass has been removed. -
changeoutput binding has been removed, instead use thecheckedChange. -
checkednow supports two-way binding.Old: New: <ibm-checkbox (change)="change($event)"> Checkbox </ibm-checkbox>
<cds-checkbox (checkedChange)="change($event)"> Checkbox </cds-checkbox>
<ibm-checkbox (change)="change($event)"> Checkbox </ibm-checkbox>
<!-- double bind --> <cds-checkbox [(checked)]="checked"> Checkbox </cds-checkbox>
-
sizeandnestedare no longer supported input properties, they were not used in v4 - remove them. -
aria-labelinput is now renamed tooariaLabelto avoid assigning aria property to component tag. -
aria-labelledbyinput is now renamed toariaLabelledbyto avoid assigning aria property to component tag.Old: New: <ibm-checkbox aria-label="Label" ariaLabelledby="label-id-1"> Checkbox </ibm-checkbox>
<cds-checkbox ariaLabel="Label" ariaLabelledby="label-id-1"> Checkbox </cds-checkbox>
-
-
- Code snippet has been rewritten & now uses
cds-icon-buttoncomponent. - There are more Input properties to customize code snippet.
- min/max number of expanded rows, min/max number of collapsed rows, etc. Visit the storybook/documentation to play around with these new properties!
- Now uses the
navigator(browser) API for copying.
- Code snippet has been rewritten & now uses
-
- Now applies disabled styling to label/helper text.
- All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
-
Theme has been marked as deprecated, use
cdsLayerinstead.
-
-
themeproperty wasn't used and has been removed, if you passed this property, remove it.
-
-
- Context menu has been rewritten.
- Template has been updated to remove list items (
ul,li) to provide better accessibility usingrole.
-
- Now applies disabled styling to label/helper text.
- All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
-
Theme has been marked as deprecated, use
cdsLayerinstead.
-
-
Custom styling has been removed. If you have used
.dayContainercss class to target the component, use the component selector. -
patterninput has been renamed toinputPatternfor more clarity.Old: New: <ibm-date-picker pattern="pattern"> </ibm-date-picker>
<ibm-date-picker inputPattern="pattern"> </ibm-date-picker>
-
Size option no longer accepts
xlvalue, uselginstead. -
Theme has been marked as deprecated, use
cdsLayerinstead.
-
-
-
closeAllfunction indialog.service.tshas been removed, use the staticDialogService.closeAllfunction instead.
Old: New: const dialogService = inject(DialogService); func() { // Deprecated dialogService.closeAll(); }
func() { DialogService.closeAll(); }
-
Module no longer exports
Tooltip,TooltipDefinition,TooltipIcon,TooltipDirectiveorEllipsesTooltip. See tooltip changes below. -
-
openfunction now accepts an optional component class to open in dialog.
-
-
- With changes to Angular 14,
ComponentFactoryResolveris no longer injected. We now pass the desired component directly to the placeholder service to render.
- With changes to Angular 14,
-
- Component has been marked as deprecated and will be removed in future versions of Angular. Instead, use the newly created Toggletip or Popover components which provide more functionality.
Old: New: <ng-template #templateRef> <div> TEMPLATE </div> </ng-template> <!-- Content rendered in placeholder --> <button [ibmOverflowMenu]="templateRef" [customPane]="true" placement="bottom"> <svg ibmIcon="settings" size="16"></svg> </button> <ibm-placeholder></ibm-placeholder>
<cds-toggletip align="bottom"> <button cdsToggletipButton> <svg ibmIcon="settings" size="16"></svg> </button> <!-- Content is now inline --> <div cdsToggletipContent> <div> TEMPLATE </div> </div> </cds-toggletip>
-
-
- Now applies disabled styling to label/helper text.
- All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
-
valueinput has been removed, useitemValueKeyinstead. -
Theme has been marked as deprecated, use
cdsLayerinstead.
-
-
invalidTitleis a new optional file item attribute, use it to add a summary of the invalid message. - The button
sizetype is now consistent with button directive,normalis no longer an acceptable size option. Usesm,md, orlg.
Old: New: <ibm-file-uploader size="normal"> ... </ibm-file-uploader>
<cds-file-uploader size="lg"> ... </cds-file-uploader>
- You can now set the
sizeof the file item (sm,md,lg(default)) of the file item.
-
-
-
- Now supports css grid, set
useCssGridtotrueto enable. Enabling css grid will automatically update columns to css grid classes. CSS Grid is the default grid enabled by carbon styles. - Import the grid variant in your
styles.scssto get started. We strongly recommend taking a look at the storybook examples to see the new grid options.
Old: New: // Previously you had to import styles @import '~carbon-components/css/carbon-components';
// Specify the grid type you want to use, v4 uses `flex-grid` // No need to set feature flag to true if you want to use css grid @use '@carbon/styles' with ( $use-flexbox-grid: true ); // or directly import if you want to use both types of grids @use '@carbon/styles/scss/grid/flexbox';
- Now supports css grid, set
-
-
leftGutter,rightGutter, &condensedinput have been removed as they are not supported in v11. If you are using these props, remove them.
-
-
- New css grid input properties, view Storybook to see the new changes.
-
-
- We've removed strings that aren't used in any components.
-
- You can now dynamically change the icon via
cdsIconinput, just make sure it is registered!
- You can now dynamically change the icon via
-
- Now applies disabled styling to label/helper text.
-
Theme has been marked as deprecated, use
cdsLayerinstead. This change applies to bothcdsText&cdsTextAreadirectives -
labelStatehas been input property has now been removed incds-labelcomponent, remove it. -
- All
sizeclasses are applied, includingmd(default). -
Size option no longer accepts
xlvalue, uselginstead.
- All
-
- A directive that applies layering style to the element it is applied to. This component is an alternative way to apply
light&darktheme to components. You'll notice that going forward,themeinput has been marked as deprecated for most components. - Setting level via
ibmLayerinput will automatically update child levels. - View storybook for more information.
- A directive that applies layering style to the element it is applied to. This component is an alternative way to apply
-
- Utility directive(s) to help with layout.
cdsStackdirective enables you to use the spacing scale to determine the gap between each stack item.
- Utility directive(s) to help with layout.
-
- FYI - Since we now use partial-ivy compilation, we removed a
remote scopingerror from ModalService. A BaseModalService is now introduced, but no change is required on your end. - Modal now accepts
mdas a size option and is the default value now. -
closeevent is now emitted onEscapekeydown. -
-
themeis now marked as deprecated
-
-
- No longer have to inject
ComponentFactoryResolverif you extend modal service due to Angular 14 changes.
- No longer have to inject
- FYI - Since we now use partial-ivy compilation, we removed a
-
-
Notification components have been updated to be more accessible out of the box.
inline-notification(default) &toasthave the role attribute set tostatusby default, with additional role options oflog&alert. -
For notifications requiring actions, use the new
ActionableNotificationcomponent, which has the role attribute set toalertdialog. -
info-square&warning-alttypes have been added to all notification variants (inline, toast, actionable). -
For all notifications, vertical margin have been removed. You can assign the container the new
ibmStacklayout directive to evenly space the notifications. -
Due to role changes,
toast&inline-notification, no longer support interactive elements (Links, additional buttons, etc.). It is still possible to pass in buttons if you use templates, however, it is highly recommended you switch to the newactionable-notificationcomponent.-
- Supports interactive elements.
- Set
notificationObj.varianttoinlineortoastto enable respective styling variation. - Like toast & inline-notifcation, there are directives to help build custom actionable notifications (
ActionableTitle,ActionableSubtitle,ActionableButton). - View demos at Carbon Angular storybook
Old: New: <ibm-notification [notificationObj]="{ type: 'success', title: 'Sample notification', message: 'Sample success message', actions: actions }"> </ibm-notification>
actionSubject = new Subject<any>(); actions = [ { text: "Action", click: this.actionSubject } ]
<cds-actionable-notification [notificationObj]="{ variant: 'inline' type: 'success', title: 'Sample notification', message: 'Sample success message' }"> </cds-actionable-notification>
actionSubject = new Subject<any>(); actions = [ { text: "Action", click: this.actionSubject } ]
-
- Interactive elements should NOT be used with this component, use actionable notification.
- Now has two selectors,
ibm-inline-notification&ibm-notification.
-
- Interactive elements should NOT be used with this component, use actionable notification.
-
-
-
- All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
-
Theme has been marked as deprecated, use
cdsLayerinstead.
- All
-
- Now wraps icon in
IconButtoncomponent. Additional props (icon button) have been added to allow customization.
- Now wraps icon in
-
- Popover directive & popover content component.
- Content that layers over all other elements on page. The logic for all tooltips is based off the popover component. All tooltips extend popover.
- For more information view carbondesignsystem or see storybook for usage in Angular.
-
- Tooltips are no longer supported in V11,
tooltiphas been removed fromStepinterface.- Use secondary label.
- Icons have been updated
- Step interface has had some major changes to better manage progress state
-
texthas been changed tolabel -
optionalTextis nowsecondaryLabel -
statehas been removed, instead we have created 2 additional propertiescomplete&invalidthat accept boolean values -
Currentstate is now managed viacurrent(index in array) input property. All steps precedingcurrentare set tocomplete(Complete set to true) & following is set toincomplete(complete set to false). - Additionally, icons are displayed in the following weighted order
current->invalid->complete->incomplete
-
Old: New: <ibm-progress-indicator [steps]="steps"> </ibm-progress-indicator> <ibm-placeholder></ibm-placeholder>
steps = [ { text: 'First', optionalText: 'Optional text', state: ['invalid', 'incomplete'] } ]
<cds-progress-indicator [steps]="steps"> </cds-progress-indicator>
steps = [ { label: 'First', secondaryLabel: 'Optional text', complete: false, invalid: true } ]
- Tooltips are no longer supported in V11,
-
- Template has been updated to include
fieldset, so you no longer have to setfieldsetexplicitly.- To go with this change, you can now pass in the
legendas a string or a template.
- To go with this change, you can now pass in the
-
invalid&warningstates have been added.
Old: New: <fieldset class="bx--fieldset"> <legend class="bx--label">LABEL</legend> <ibm-radio-group> <ibm-radio>Zero</ibm-radio> <ibm-radio>One</ibm-radio> <ibm-radio>Two</ibm-radio> <ibm-radio>Three</ibm-radio> </ibm-radio-group> </fieldset>
<!-- Wraps all radios in a fieldset now, can pass string or template in legend --> <ibm-radio-group legend="label"> <ibm-radio>Zero</ibm-radio> <ibm-radio>One</ibm-radio> <ibm-radio>Two</ibm-radio> <ibm-radio>Three</ibm-radio> </ibm-radio-group>
<fieldset class="bx--fieldset"> <legend class="bx--label"> Label <svg cdsIcon="fade"></svg> </legend> <ibm-radio-group> <ibm-radio>Zero</ibm-radio> <ibm-radio>One</ibm-radio> <ibm-radio>Two</ibm-radio> <ibm-radio>Three</ibm-radio> </ibm-radio-group> </fieldset>
<!-- Example with template --> <ng-template #radioLegend> Label <svg cdsIcon="fade"></svg> </ng-template> <ibm-radio-group legend="radioLegend"> <ibm-radio>Zero</ibm-radio> <ibm-radio>One</ibm-radio> <ibm-radio>Two</ibm-radio> <ibm-radio>Three</ibm-radio> </ibm-radio-group>
- Template has been updated to include
-
- Toolbar search is deprecated & removed in Carbon V11. (Wrapping
ibm-searchindiv.cds--toolbar) - All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
-
Theme has been marked as deprecated, use
cdsLayerinstead.
- Toolbar search is deprecated & removed in Carbon V11. (Wrapping
-
- Now applies disabled styling to label/helper text.
- All
sizeclasses are applied, includingmd(default).-
Size option no longer accepts
xlvalue, uselginstead.
-
Size option no longer accepts
- All
- Custom component
stylehave been removed. -
Theme has been marked as deprecated, use
cdsLayerinstead.
- Now applies disabled styling to label/helper text.
-
- Now applies disabled styling to label/helper text.
-
- Improved accessibility, styles are applied to row on
focusevent. - You can now dynamically set
selectedfor a List Row -
border&nowrapinput did not apply any styles hence, removed. If you are using this prop, remove them. - You can now align content with margin using
flushedproperty
- Improved accessibility, styles are applied to row on
-
-
Drag & drop features from our legacy code base has been commented out until Carbon supports it out of the box.
-
Table no longer supports size
sh, instead usexs. -
Filter button has been removed from
TableHeadCellas it was part of our legacy code base. -
We've renamed
changeoutput toselectedChangeto allow double binding for TableCheckbox component (ibmTableCheckbox/cdsTableCheckbox).
Old: New: <td ibmTableCheckbox (change)="onSelectionChange()"> </td>
<td cdsTableCheckbox (selectedChange)="onSelectionChange()"> </td>
-
sizeinput fromcdsTableHeadCheckbox&cdsTableHeaddirective has been removed due to the removal in checkbox component. If you're these properties remove them.
-
-
- Tabs have been rewritten to use buttons instead of
navelements. -
typenow acceptscontained(previously container) &line(previously default). This change is made to reflect the naming convention on carbondesignsystem.com. -
ibm-tab-headercomponent has been converted to a directive, hence a button withibmTabHeadershould be used.
Old: New: <ibm-tab-header-group type="container"> <ibm-tab-header [paneReference]="content1"> Content 1 </ibm-tab-header> </ibm-tab-header-group> <ibm-tab #content1> Tab content 1 </ibm-tab>
<cds-tab-header-group type="contained"> <button cdsTabHeader [paneReference]="content1"> Content 1 </button> </cds-tab-header-group> <cds-tab #content1> Tab Content 1 </cds-tab>
- You can now use the new
TabSkeletoncomponent withibm-tab-header-groupto indicate loading (With *ngIf, see storybook).
- Tabs have been rewritten to use buttons instead of
-
- Directive that allows you to set the theme
white,g10,g90,g100to any element. All elements within the container will have the theme styles applied. - Theme resets the layer count to 1 (Starts from 0).
- View storybook for more information.
- Directive that allows you to set the theme
-
-
Theme has been marked as deprecated, use
cdsLayerinstead. - You no longer need to remember those long class names! Introduced fold directives for expandable tiles.
- Expandable tile now supports
interactivecontent. Simply setinteractivetotrue.
-
Theme has been marked as deprecated, use
-
- Now applies disabled styling to label text.
-
Theme has been marked as deprecated, use
cdsLayerinstead. - Added
sizeinput property which acceptssm,md, &lg.- All
sizeclasses are applied, includingmd(default).
- All
-
- Toggle has been completely rewritten to improve accessibility & flexibility of layout
- In previous version,
<input type="checkbox">was used, this has now been switched to<button role="switch"> -
ToggleChangeclass is now removed -
changeevent has been removed, now usecheckedChange(Same as checkbox) or simply double bind!
Old: New: <ibm-toggle (toggleChange)="func($event)" (change)="func($event)"> </ibm-toggle>
<cds-toggle [(checked)]="checked" (checkedChange)="func($event)"> </cds-toggle>
-
- Tooltips no longer support interactive content, use
Toggletipfor such situations. The API for tooltip has been updated & the component has been rewritten to use thePopovercomponent/directive. - Unlike previously, triggers are predefined for all types of tooltip according to Carbon standards.
-
Tooltipopens on mouseenter (or programmatically) -
Tooltip definitionopens on mouse click (or programmatically) -
Toggletipopens on mouse click (or programmatically)
-
- API has been simplified and no longer need to add
ibm-placeholderas all tooltip components are designed to be inline.
Old: New: <!-- Template for dynamic content--> <ng-template #template let-tooltip="tooltip"> <p>This is some tooltip text.</p> <div class="bx--tooltip__footer"> <a href="/" class="bx--link">Learn More</a> </div> </ng-template> <div class="bx--tooltip__label"> {{triggerText}} <span [ibmTooltip]="template" [offset]="offset" trigger="click" [placement]="placement"> <div role="button"> <svg ibmIcon="information--filled" size="16"></svg> </div> </span> </div> <ibm-placeholder></ibm-placeholder>
<span cdsToggletipLabel>Toggletip label</span> <cds-toggletip [isOpen]="isOpen" [align]="align" (isOpenChange)="isOpenChange($event)"> <button cdsToggletipButton> <svg ibmIcon="information--filled" size="16"></svg> </button> <!-- Dynamic content wrapper--> <div cdsToggletipContent> <p>This is some tooltip text.</p> <div class="bx--tooltip__footer"> <a href="/" class="bx--link">Learn More</a> </div> </div> </cds-toggletip>
-
- Due to accessibility issues, this component has been removed.
- You can use the new
Tooltipor Icon button component as a replacement.
Old: New: <ibm-tooltip-icon content="Setting"> <svg>...</svg> </ibm-tooltip-icon>
<cds-tooltip description="Setting"> <svg>...</svg> </cds-tooltip>
-
- Use tooltip instead
Old: New: <span class="ellipsis" ibmEllipsisTooltip> Tooltip for ellipsis because I can and I am really really long </span> <ibm-placeholder></ibm-placeholder>
<cds-tooltip description="Tooltip for ellipsis because I can and I am really really long"> <!-- Set style to make the text overflow --> <span class="overflowText"> Tooltip for ellipsis because I can and I am really really long </span> </cds-tooltip>
-
Certain input properties (auto-align) will be available soon.
- Tooltips no longer support interactive content, use
-
-
A lot of the accessibility issues have now been addressed with the shell!
-
- Now uses icon buttons component, additional property bindings have been added to customize experience.
-
titleproperty has been removed in favor ofdescription
Old:
<ibm-header-action title="action"></ibm-header-action>
New:
<cds-header-action description="action"></cds-header-action>
-
Let us know if you run into any issues with the migration on Slack. We have a few things in the work to improve documentation & storybook experience.