How to use the lit-html/directives/class-map.classMap function in lit-html

To help you get started, we’ve selected a few lit-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github axa-ch / patterns-library / src / components / 30-organisms / footer / index.js View on Github external
return html`
      <footer class="o-footer">
        
          <div class="o-footer__content">
            <div class="o-footer__collection">
              <div class="o-footer__main">
                <button class="o-footer__accordion-button">
                  
                  <span class="${classMap(accordionCaretState(0))}">
                    ${showCaret}
                  </span>
                </button>
                <ul class="${classMap(accordionContent)}">
                  ${repeat(
                    new Array(
                      this.querySelectorAll('[slot^="column-0-item-"]').length
                    ),
                    (item, index) =&gt; _renderFooterLinks(0, index)
                  )}
                </ul>
              </div>

              <div class="o-footer__main">
                <button class="o-footer__accordion-button">
                  
                  <span class="${classMap(accordionCaretState(1))}"></span></button></div></div></div></footer>
github axa-ch / patterns-library / src / components / 10-atoms / button / index.js View on Github external
'a-button--motion': !motionOff,
      'a-button--secondary': variant === 'secondary',
      'a-button--red': variant === 'red',
      'a-button--inverted': variant.includes('inverted'),
      'a-button--inverted-blue-ocean': variant === 'inverted-blue-ocean',
      'a-button--inverted-red-tosca': variant === 'inverted-red-tosca',
      'a-button--inverted-purple-logan': variant === 'inverted-purple-logan',
      'a-button--inverted-green-viridian':
        variant === 'inverted-green-viridian',
      'a-button--inverted-blue-teal': variant === 'inverted-blue-teal',
    };

    return html`
      <button class="${classMap(classes)}" type="${type}">
        <span class="a-button__flex-wrapper">
          ${this.showIcon
            ? html`
                
              `
            : ''}
          
          ${this.showArrow
            ? html`
                
              `
            : ''}
        </span></button>
github carbon-design-system / carbon-custom-elements / src / components / tabs / tabs.ts View on Github external
render() {
    const {
      triggerContent,
      _assistiveStatusText: assistiveStatusText,
      _open: open,
      _selectedItemContent: selectedItemContent,
    } = this;
    const triggerClasses = classMap({
      [`${prefix}--tabs-trigger`]: true,
      [`${prefix}--tabs-trigger--open`]: open,
    });
    const listClasses = classMap({
      [`${prefix}--tabs__nav`]: true,
      [`${prefix}--tabs__nav--hidden`]: !open,
    });
    return html`
      <div aria-controls="tablist" aria-owns="tablist" aria-haspopup="listbox" aria-expanded="${String(open)}" aria-labelledby="trigger-label" class="${triggerClasses}" role="button" id="trigger">
        <span class="${prefix}--tabs-trigger-text" id="trigger-label">
          ${selectedItemContent || triggerContent}</span></div>
github carbon-design-system / carbon-custom-elements / src / components / search / search.ts View on Github external
render() {
    const {
      closeButtonAssistiveText,
      disabled,
      labelText,
      name,
      placeholder,
      size,
      type,
      value = '',
      _handleInput: handleInput,
      _handleClearInputButtonClick: handleClearInputButtonClick,
    } = this;
    const clearClasses = classMap({
      [`${prefix}--search-close`]: true,
      [`${prefix}--search-close--hidden`]: !this.value,
    });
    return html`
      ${Search16({
        class: `${prefix}--search-magnifier`,
        role: 'img',
      })}
      <label class="${prefix}--label" for="input">
        ${labelText}
      </label>
github material-components / material-components-web-components / packages / dialog / src / mwc-dialog-base.ts View on Github external
return html`
    <div aria-describedby="content" aria-labelledby="title" aria-modal="true" role="alertdialog" class="mdc-dialog ${classMap(classes)}">
      <div class="mdc-dialog__container">
        <div class="mdc-dialog__surface">
          ${heading}
          <div class="mdc-dialog__content" id="content">
            
          </div>
          <footer class="${classMap(actionsClasses)}" id="actions">
            <span>
              
            </span>
            <span>
             
            </span>
          </footer>
        </div>
      </div>
      <div class="mdc-dialog__scrim"></div>
    </div>`;
  }
github MaritzSTL / chameleon / packages / dialog / src / chameleon-dialog.ts View on Github external
render(): TemplateResult {
    return html`
      <div class="${classMap({
          overlay: true,
          open: this.open,
          close: !this.open
        })}">
        
          <div class="dialog">
          ${
            this.dismissible
              ? html`
                  </div></div>
github home-assistant / home-assistant-polymer / src / panels / config / automation / ha-automation-editor.ts View on Github external
)}"
                    icon="hass:delete"
                    @click=${this._delete}
                  &gt;
                `}
          
        

        <div class="content">
          ${this._errors
            ? html`
                <div class="errors">${this._errors}</div>
              `
            : ""}
          <div class="${classMap({
              rtl: computeRTL(this.hass),
            })}">
            ${this._config
              ? html`
                  
                    <span slot="header">${this._config.alias}</span>
                    <span slot="introduction">
                      ${this.hass.localize(
                        "ui.panel.config.automation.editor.introduction"
                      )}
                    </span>
                    
                      <div class="card-content">
                        </div></div></div>
github carbon-design-system / carbon-custom-elements / src / components / inline-loading / inline-loading.ts View on Github external
private _renderIcon() {
    const { status } = this;
    if (status === INLINE_LOADING_STATE.ERROR) {
      return Error20({
        class: `${prefix}--inline-loading--error`,
      });
    }
    if (status === INLINE_LOADING_STATE.FINISHED) {
      return CheckmarkFilled16({
        class: `${prefix}--inline-loading__checkmark-container ${prefix}--inline-loading__svg`,
      });
    }
    if (status === INLINE_LOADING_STATE.INACTIVE || status === INLINE_LOADING_STATE.ACTIVE) {
      const classes = classMap({
        [`${prefix}--loading ${prefix}--loading--small`]: true,
        [`${prefix}--loading--stop`]: status === INLINE_LOADING_STATE.INACTIVE,
      });
      return html`
        <div class="${classes}">
          ${getLoadingIcon({ type: LOADING_TYPE.SMALL })}
        </div>
      `;
    }
    return undefined;
  }
github material-components / material-components-web-components / packages / drawer / src / mwc-drawer-base.ts View on Github external
protected render() {
    const dismissible = this.type === 'dismissible' || this.type === 'modal';
    const modal = this.type === 'modal';
    const header = this.hasHeader ? html`
      <div class="mdc-drawer__header">
        <h3 class="mdc-drawer__title"></h3>
        <h6 class="mdc-drawer__subtitle"></h6>
        
      </div>
      ` :
                                    '';
    return html`
      <aside class="mdc-drawer
          ${classMap({
      'mdc-drawer--dismissible': dismissible,
      'mdc-drawer--modal': modal
    })}">
        ${header}
        <div class="mdc-drawer__content"></div>
      </aside>
      ${
        modal ? html`<div class="mdc-drawer-scrim"></div>` :
                ''}
      <div class="mdc-drawer-app-content">
        
      </div>
      `;
  }
github MaritzSTL / chameleon / packages / select / src / chameleon-select.ts View on Github external
render(): TemplateResult {
    return html`
      <div class="${classMap({">
        <div class="chameleon-select tags">
          ${this.renderedSelectedOptions}
        </div>
        <div class="chameleon-select select">
          ${this.selectCaret}
        </div>
        ${this.searchBar} ${this.optionsList}
      </div>
    `;
  }