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

Method render

core/src/components/searchbar/searchbar.tsx:643–750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

641 }
642
643 render() {
644 const { cancelButtonText, autocapitalize } = this;
645 const animated = this.animated && config.getBoolean('animated', true);
646 const mode = getIonMode(this);
647 const clearIcon = this.clearIcon || (mode === 'ios' ? closeCircle : closeSharp);
648 const searchIcon = this.searchIcon || (mode === 'ios' ? searchOutline : searchSharp);
649 const shouldShowCancelButton = this.shouldShowCancelButton();
650
651 const cancelButton = this.showCancelButton !== 'never' && (
652 <button
653 aria-label={cancelButtonText}
654 // Screen readers should not announce button if it is not visible on screen
655 aria-hidden={shouldShowCancelButton ? undefined : 'true'}
656 type="button"
657 tabIndex={mode === 'ios' && !shouldShowCancelButton ? -1 : undefined}
658 onMouseDown={this.onCancelSearchbar}
659 onTouchStart={this.onCancelSearchbar}
660 class="searchbar-cancel-button"
661 >
662 <div aria-hidden="true">
663 {mode === 'md' ? (
664 <ion-icon aria-hidden="true" mode={mode} icon={this.cancelButtonIcon} lazy={false}></ion-icon>
665 ) : (
666 cancelButtonText
667 )}
668 </div>
669 </button>
670 );
671
672 return (
673 <Host
674 role="search"
675 aria-disabled={this.disabled ? 'true' : null}
676 class={createColorClasses(this.color, {
677 [mode]: true,
678 'searchbar-animated': animated,
679 'searchbar-disabled': this.disabled,
680 'searchbar-no-animate': animated && this.noAnimate,
681 'searchbar-has-value': this.hasValue(),
682 'searchbar-left-aligned': this.shouldAlignLeft,
683 'searchbar-has-focus': this.focused,
684 'searchbar-should-show-clear': this.shouldShowClearButton(),
685 'searchbar-should-show-cancel': this.shouldShowCancelButton(),
686 })}
687 >
688 <div class="searchbar-input-container">
689 <input
690 aria-label="search text"
691 disabled={this.disabled}
692 ref={(el) => (this.nativeInput = el)}
693 class="searchbar-input"
694 inputMode={this.inputmode}
695 enterKeyHint={this.enterkeyhint}
696 name={this.name}
697 onInput={this.onInput}
698 onChange={this.onChange}
699 onBlur={this.onBlur}
700 onFocus={this.onFocus}

Callers

nothing calls this directly

Calls 7

hasValueMethod · 0.95
shouldShowClearButtonMethod · 0.95
getValueMethod · 0.95
getIonModeFunction · 0.90
createColorClassesFunction · 0.90
getBooleanMethod · 0.45

Tested by

no test coverage detected