MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / renderButtons

Method renderButtons

core/src/components/toast/toast.tsx:612–653  ·  view source on GitHub ↗
(buttons: ToastButton[], side: 'start' | 'end')

Source from the content-addressed store, hash-verified

610 };
611
612 renderButtons(buttons: ToastButton[], side: 'start' | 'end') {
613 if (buttons.length === 0) {
614 return;
615 }
616
617 const mode = getIonMode(this);
618 const buttonGroupsClasses = {
619 'toast-button-group': true,
620 [`toast-button-group-${side}`]: true,
621 };
622 return (
623 <div class={buttonGroupsClasses}>
624 {buttons.map((b) => (
625 <button
626 {...b.htmlAttributes}
627 type="button"
628 class={buttonClass(b)}
629 tabIndex={0}
630 onClick={() => this.buttonClick(b)}
631 part={buttonPart(b)}
632 >
633 <div class="toast-button-inner">
634 {b.icon && (
635 <ion-icon
636 aria-hidden="true"
637 icon={b.icon}
638 slot={b.text === undefined ? 'icon-only' : undefined}
639 class="toast-button-icon"
640 />
641 )}
642 {b.text}
643 </div>
644 {mode === 'md' && (
645 <ion-ripple-effect
646 type={b.icon !== undefined && b.text === undefined ? 'unbounded' : 'bounded'}
647 ></ion-ripple-effect>
648 )}
649 </button>
650 ))}
651 </div>
652 );
653 }
654
655 /**
656 * Render the `message` property.

Callers 1

renderMethod · 0.95

Calls 4

buttonClickMethod · 0.95
getIonModeFunction · 0.90
buttonPartFunction · 0.85
buttonClassFunction · 0.70

Tested by

no test coverage detected