Skip to content

Commit 8260caf

Browse files
committed
fix(toolbar): updating slot classes and widths on change so that content can be added dynamically
1 parent d2578fe commit 8260caf

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

core/src/components/toolbar/toolbar.ionic.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
// the sizes of the different slots and sets what size the pairs should be
6666
// based on the larger one. We then use `flex-basis` to set the expected
6767
// size of the slots and disable `flex-shrink` so that the smaller slot cannot
68-
// shrink and throw off the center. The slots are paired up so the mirroring slots
68+
// shrink and throw off the center, we also diable flex-grow so that slots do
69+
// not grow more than they need. The slots are paired up so the mirroring slots
6970
// always have the same size. That is, start and end are paired and primary
7071
// and secondary are paired. All of this works together to force the main
7172
// content to maintain the center as best as CSS allows while also allowing

core/src/components/toolbar/toolbar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ export class Toolbar implements ComponentInterface {
243243
>
244244
<div class="toolbar-background" part="background"></div>
245245
<div class="toolbar-container" part="container">
246-
<slot name="start"></slot>
247-
<slot name="secondary"></slot>
246+
<slot name="start" onSlotchange={() => this.updateSlotClasses}></slot>
247+
<slot name="secondary" onSlotchange={() => this.updateSlotClasses}></slot>
248248
<div class="toolbar-content" part="content">
249249
<slot></slot>
250250
</div>
251-
<slot name="primary"></slot>
252-
<slot name="end"></slot>
251+
<slot name="primary" onSlotchange={() => this.updateSlotClasses}></slot>
252+
<slot name="end" onSlotchange={() => this.updateSlotClasses}></slot>
253253
</div>
254254
</Host>
255255
);

0 commit comments

Comments
 (0)