How to use @carbon/icons - 10 common examples

To help you get started, we’ve selected a few @carbon/icons 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 carbon-design-system / carbon-custom-elements / src / components / structured-list / structured-list-row.ts View on Github external
render() {
    const { selected, selectionName, selectionValue, selectionIconTitle } = this;
    if (selectionName) {
      // "Selected" style with `.bx--structured-list-td` does not work somehow - Need investigation
      return html`
        
        <input value="${ifDefined(selectionValue)}" name="${selectionName}" class="${prefix}--structured-list-input" type="radio" id="input">
        <div class="${prefix}--structured-list-td ${prefix}--structured-list-cell">
          ${CheckmarkFilled16({
            class: `${prefix}--structured-list-svg`,
            title: selectionIconTitle,
          })}
        </div>
      `;
    }
    return html`
      
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / data-table / table-row.ts View on Github external
render() {
    const { disabled, section, selected, selectionLabel, selectionName, selectionValue } = this;
    const expando = !section
      ? undefined
      : html`
          <div class="${prefix}--table-expand">
            <button class="${prefix}--table-expand__button">
              ${ChevronRight16({ class: `${prefix}--table-expand__svg` })}
            </button>
          </div>
        `;
    // Using `@click` instead of `@change` to support `.preventDefault()`
    const selection = !selectionName
      ? undefined
      : html`
          <div class="${prefix}--table-column-checkbox">
            ${html`
              </div>
github carbon-design-system / carbon-custom-elements / src / components / pagination / pages-select.ts View on Github external
render() {
    const { formatLabelText, formatSupplementalText, total, value, _handleChange: handleChange } = this;
    return html`
      <div class="${prefix}--select__page-number">
        <label class="${prefix}--label ${prefix}--visually-hidden" for="select">
          ${formatLabelText({ count: total })}
        </label>
        <select class="${prefix}--select-input" id="select">
          ${Array.from(new Array(total)).map(
            (_item, index) =&gt; html`
              <option value="${index}">${index + 1}</option>
            `
          )}
        </select>
        ${ChevronDown16({ class: `${prefix}--select__arrow` })}
      </div>
      <span class="${prefix}--pagination__text">
        ${formatSupplementalText({ count: total })}
      </span>
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / tabs / tabs.ts View on Github external
});
    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>
        ${ChevronDown16({ 'aria-hidden': 'true' })}
      </div>
      <ul class="${listClasses}" role="tablist" id="tablist">
        
      </ul>
      <div aria-relevant="additions text" aria-live="assertive" role="status" class="${prefix}--assistive-text">
        ${assistiveStatusText}
      </div>
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / tile / expandable-tile.ts View on Github external
render() {
    const { collapsedAssistiveText, expandedAssistiveText, expanded } = this;
    const assistiveText = expanded ? expandedAssistiveText : collapsedAssistiveText;
    return html`
      <button aria-labelledby="icon" class="${prefix}--tile__chevron">
        ${ChevronDown16({
          id: 'icon',
          alt: assistiveText,
          description: assistiveText,
          'aria-label': assistiveText,
        })}
      </button>
      <div class="${prefix}--tile-content">
        
      </div>
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / dropdown / dropdown.ts View on Github external
<div class="${classes}" role="listbox">
        ${validityIcon}
        <div aria-controls="menu-body" aria-owns="menu-body" aria-haspopup="listbox" aria-expanded="${String(open)}" aria-labelledby="trigger-label" tabindex="${ifDefined(!shouldTriggerBeFocusable ? undefined : '0')}" class="${prefix}--list-box__field" role="${ifDefined(!shouldTriggerBeFocusable ? undefined : 'button')}">
          ${this._renderPrecedingTriggerContent()}${this._renderTriggerContent()}${this._renderFollowingTriggerContent()}
          <div class="${iconContainerClasses}">
            ${ChevronDown16({ 'aria-label': toggleLabel })}
          </div>
        </div>
        ${menuBody}
      </div>
      ${validity}
      <div aria-relevant="additions text" aria-live="assertive" role="status" class="${prefix}--assistive-text">
        ${assistiveStatusText}
      </div>
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / pagination / page-sizes-select.ts View on Github external
render() {
    const { labelText, value, _handleChange: handleChange, _handleSlotChange: handleSlotChange } = this;
    return html`
      <label class="${prefix}--pagination__text" for="select">${labelText}</label>
      <div class="${prefix}--select__item-count">
        <select class="${prefix}--select-input" id="select"></select>
        ${ChevronDown16({ class: `${prefix}--select__arrow` })}
      </div>
      <div hidden=""></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 carbon-design-system / carbon-custom-elements / src / components / tile / selectable-tile.ts View on Github external
render() {
    const { checkmarkLabel, name, selected, value, _inputType: inputType, _handleChange: handleChange } = this;
    return html`
      <input value="${ifNonNull(value)}" name="${ifNonNull(name)}" tabindex="-1" class="${prefix}--tile-input" id="input" type="${inputType}">
      <label tabindex="0" class="${prefix}--tile ${prefix}--tile--selectable" for="input">
        <div class="${prefix}--tile__checkmark">
          ${CheckmarkFilled16({
            children: !checkmarkLabel ? undefined : svg`<title>${checkmarkLabel}</title>`,
          })}
        </div>
        <div class="${prefix}--tile-content"></div>
      </label>
    `;
  }
github carbon-design-system / carbon-custom-elements / src / components / ui-shell / header-menu-button.ts View on Github external
render() {
    const { active, buttonLabelActive, buttonLabelInactive, disabled, _handleClick: handleClick } = this;
    const buttonLabel = active ? buttonLabelActive : buttonLabelInactive;
    const classes = classMap({
      [`${prefix}--header__action`]: true,
      [`${prefix}--header__menu-trigger`]: true,
      [`${prefix}--header__menu-toggle`]: true,
      [`${prefix}--header__action--active`]: active,
    });
    return html`
      <button aria-label="${ifNonNull(buttonLabel)}" class="${classes}">
        ${active ? Close20() : Menu20()}
      </button>
    `;
  }