Skip to content

Commit 3734a2a

Browse files
committed
feat(dropdown): add centered dropdown and centered dropup
1 parent 93b9340 commit 3734a2a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

projects/coreui-angular/src/lib/dropdown/dropdown/dropdown.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class DropdownComponent implements AfterContentInit, OnDestroy, OnInit {
141141
* Sets a specified direction and location of the dropdown menu.
142142
* @type 'dropup' | 'dropend' | 'dropstart'
143143
*/
144-
@Input() direction?: 'dropup' | 'dropend' | 'dropstart';
144+
@Input() direction?: 'center' | 'dropup' | 'dropup-center' | 'dropend' | 'dropstart';
145145

146146
/**
147147
* Describes the placement of your component after Popper.js has applied all the modifiers that may have flipped or altered the originally provided placement property.
@@ -186,6 +186,14 @@ export class DropdownComponent implements AfterContentInit, OnDestroy, OnInit {
186186
placement = 'left-start';
187187
break;
188188
}
189+
case 'center': {
190+
placement = 'bottom';
191+
break;
192+
}
193+
case 'dropup-center': {
194+
placement = 'top';
195+
break;
196+
}
189197
}
190198
if (this.alignment === 'end') {
191199
placement = 'bottom-end';
@@ -250,9 +258,7 @@ export class DropdownComponent implements AfterContentInit, OnDestroy, OnInit {
250258
(this.variant === 'dropdown' || this.variant === 'nav-item') &&
251259
!this.direction,
252260
[`${this.direction}`]: !!this.direction,
253-
'btn-group': this.variant === 'btn-group',
254-
'nav-item': this.variant === 'nav-item',
255-
'input-group': this.variant === 'input-group',
261+
[`${this.variant}`]: !!this.variant,
256262
show: this.visible
257263
};
258264
}

0 commit comments

Comments
 (0)