Skip to content

Commit 45e8681

Browse files
committed
fix(chip): correct broken variant type and restrict to union, reword
1 parent f4c9a83 commit 45e8681

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 20.0.0
6+
7+
### General
8+
- `IgxChip`
9+
- **Behavioral Change** The `variant` is now strictly typed with the union of supported options and no longer accepts invalid values for the default state, provide no value (nullish) instead is needed.
10+
511
## 19.2.0
612

713
### General

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const IgxChipTypeVariant = {
3232
WARNING: 'warning',
3333
DANGER: 'danger'
3434
} as const;
35+
export type IgxChipTypeVariant = (typeof IgxChipTypeVariant)[keyof typeof IgxChipTypeVariant];
3536

3637
export interface IBaseChipEventArgs extends IBaseEventArgs {
3738
originalEvent: IDragBaseEventArgs | IDropBaseEventArgs | KeyboardEvent | MouseEvent | TouchEvent;
@@ -93,15 +94,15 @@ export class IgxChipComponent implements OnInit, OnDestroy {
9394
*
9495
* @remarks
9596
* Allowed values are `primary`, `info`, `success`, `warning`, `danger`.
96-
* Providing an invalid value won't change the chip.
97+
* Providing no/nullish value leaves the chip in its default state.
9798
*
9899
* @example
99100
* ```html
100-
* <igx-chip [variant]="success"></igx-chip>
101+
* <igx-chip variant="success"></igx-chip>
101102
* ```
102103
*/
103104
@Input()
104-
public variant: string | typeof IgxChipTypeVariant;
105+
public variant?: IgxChipTypeVariant | null;
105106
/**
106107
* Sets the value of `id` attribute. If not provided it will be automatically generated.
107108
*

0 commit comments

Comments
 (0)