• Light
  • Dark
  • Darkest
  • Medium
  • Large
  • LTR
  • RTL
  • Default
  • Express

Close Button

Component status
Contribution
Last releasedJune 7, 2022
Current version@spectrum-css/closebutton@1.2.11

Usage notes


A button used to close or dismiss components.

Variants


Icon Size - Regular
Verified

Close button supports different sized icons. By default, you should use the following icons:

Close button classname UI icon classname
.spectrum-CloseButton--sizeS .spectrum-UIIcon-Cross75
.spectrum-CloseButton--sizeM .spectrum-UIIcon-Cross100
.spectrum-CloseButton--sizeL .spectrum-UIIcon-Cross200
.spectrum-CloseButton--sizeXL .spectrum-UIIcon-Cross300

S

M (default)

L

XL

Show markup
<div class="spectrum-Examples">
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">S</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeS">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross75" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross75" />
        </svg>
      </button>
    </div>
  </div>
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">M (default)</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross100" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross100" />
        </svg>
      </button>
    </div>
  </div>

  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">L</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeL">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross200" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross200" />
        </svg>
      </button>
    </div>
  </div>

  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">XL</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeXL">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
    </div>
  </div>
</div>

Icon Size - Large
Verified

Close button supports different sized icons. For cases where you need large icons, you should use the following icons:

Close button classname UI icon classname
.spectrum-CloseButton--sizeS .spectrum-UIIcon-Cross200
.spectrum-CloseButton--sizeM .spectrum-UIIcon-Cross300
.spectrum-CloseButton--sizeL .spectrum-UIIcon-Cross400
.spectrum-CloseButton--sizeXL .spectrum-UIIcon-Cross500

S

M (default)

L

XL

Show markup
<div class="spectrum-Examples">
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">S</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeS">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross200" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross200" />
        </svg>
      </button>
    </div>
  </div>
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">M (default)</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
    </div>
  </div>

  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">L</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeL">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross400" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross400" />
        </svg>
      </button>
    </div>
  </div>

  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">XL</h4>

    <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeXL">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross500" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross500" />
        </svg>
      </button>
    </div>
  </div>
</div>

Disabled
Verified

Show markup
<button class="spectrum-CloseButton spectrum-CloseButton--sizeM" disabled>
  <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
    <use xlink:href="#spectrum-css-icon-Cross300" />
  </svg>
</button>

Static White
Verified

Default

Disabled

Show markup
<div style="background-color: rgb(15, 121, 125); color: rgb(15, 121, 125); padding: 15px 20px;">
  <div class="spectrum-Examples" style="display: inline-flex; gap: 24px;">
    <div class="spectrum-Examples-item">
      <h4 style="color: white" class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">Default</h4>

      <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM spectrum-CloseButton--staticWhite">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
      </div>
    </div>
    <div class="spectrum-Examples-item">
      <h4 style="color: white" class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">Disabled</h4>

      <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM spectrum-CloseButton--staticWhite" disabled>
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
      </div>
    </div>
  </div>
</div>

Static Black
Verified

Default

Disabled

Show markup
<div style="background-color: rgb(181, 209, 211); color: rgb(181, 209, 211); padding: 15px 20px;">
  <div class="spectrum-Examples" style="display: inline-flex; gap: 24px">
    <div class="spectrum-Examples-item">
      <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">Default</h4>

      <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM spectrum-CloseButton--staticBlack">
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
      </div>
    </div>
    <div class="spectrum-Examples-item">
      <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">Disabled</h4>

      <div class="spectrum-Examples-itemGroup">
      <button class="spectrum-CloseButton spectrum-CloseButton--sizeM spectrum-CloseButton--staticBlack" disabled>
        <svg class="spectrum-CloseButton-UIIcon spectrum-Icon spectrum-UIIcon-Cross300" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-Cross300" />
        </svg>
      </button>
      </div>
    </div>
  </div>
</div>