-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to specify any selector in the container for the Dropdown component
- Loading branch information
Showing
5 changed files
with
93 additions
and
8 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
demo/src/app/components/dropdown/demos/container-string/dropdown-container-string.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<p> | ||
Set the <code>container</code> property to "body" to have the dropdown menu be appended to the body instead of where | ||
it belongs. This option is useful if the dropdown is defined inside an element that clips its contents (i.e. | ||
<code>overflow: hidden</code>). | ||
</p> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Items</th> | ||
<th scope="col">Actions</th> | ||
<th scope="col">Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1</td> | ||
<td> | ||
Item | ||
<div> | ||
<small class="text-muted">Both “Actions” table cells define an overflow hidden</small> | ||
</div> | ||
</td> | ||
<td class="ngb-dropdown-container"> | ||
<div class="overflow-hidden"> | ||
<div ngbDropdown container=".ngb-dropdown-container"> | ||
<button type="button" class="btn btn-outline-primary btn-sm" ngbDropdownToggle>Actions</button> | ||
<div ngbDropdownMenu> | ||
<button ngbDropdownItem>Edit</button> | ||
<button ngbDropdownItem>Duplicate</button> | ||
<button ngbDropdownItem>Move</button> | ||
<div class="dropdown-divider"></div> | ||
<button ngbDropdownItem>Delete</button> | ||
</div> | ||
</div> | ||
<small class="text-muted">Dropdown uses container "body"</small> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="overflow-hidden"> | ||
<div ngbDropdown> | ||
<button type="button" class="btn btn-outline-primary btn-sm" ngbDropdownToggle>Actions</button> | ||
<div ngbDropdownMenu> | ||
<button ngbDropdownItem>Edit</button> | ||
<button ngbDropdownItem>Duplicate</button> | ||
<button ngbDropdownItem>Move</button> | ||
<div class="dropdown-divider"></div> | ||
<button ngbDropdownItem>Delete</button> | ||
</div> | ||
</div> | ||
<small class="text-muted">Default dropdown</small> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
10 changes: 10 additions & 0 deletions
10
demo/src/app/components/dropdown/demos/container-string/dropdown-container-string.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; | ||
|
||
@Component({ | ||
selector: 'ngbd-dropdown-container', | ||
standalone: true, | ||
imports: [NgbDropdownModule], | ||
templateUrl: './dropdown-container-string.html', | ||
}) | ||
export class NgbdDropdownContainerString {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters