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

Button - negative

Component status
Contribution
Current version@spectrum-css/button@13.4.0
ReleasedOctober 4, 2024
S2-foundations@spectrum-css/button@14.0.0-s2-foundations.18
ReleasedOctober 4, 2024

Usage notes


The negative button is for high emphasis of negative or destructive actions.

Variants


Sizing
Contribution

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>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeS">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeS">
      <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeS spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">M (default)</h4>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeM">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeM">
      <svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeM spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>

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

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeL">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeL">
      <svg class="spectrum-Icon spectrum-Icon--sizeL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeL spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>

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

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeXL">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeXL">
      <svg class="spectrum-Icon spectrum-Icon--sizeXL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--fill spectrum-Button--negative spectrum-Button--sizeXL spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeXL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>
</div>

Disabled
Contribution

Show markup
<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--fill spectrum-Button--negative" disabled>
  <span class="spectrum-Button-label">Delete</span>
</button>

<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--fill spectrum-Button--negative" disabled>
  <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
    <use xlink:href="#spectrum-icon-18-Delete" />
  </svg>
  <span class="spectrum-Button-label">Delete</span>
</button>

<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--fill spectrum-Button--negative spectrum-Button--iconOnly" aria-label="Delete" disabled>
  <svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true">
    <use xlink:href="#spectrum-icon-18-Delete" />
  </svg>
</button>

Outline
Contribution

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>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeS">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeS">
      <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeS spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>
  <div class="spectrum-Examples-item">
    <h4 class="spectrum-Heading spectrum-Heading--sizeXS spectrum-Examples-itemHeading">M (default)</h4>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeM">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeM">
      <svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeM spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeM" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>

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

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeL">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeL">
      <svg class="spectrum-Icon spectrum-Icon--sizeL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeL spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>

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

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeXL">
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeXL">
      <svg class="spectrum-Icon spectrum-Icon--sizeXL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
      <span class="spectrum-Button-label">Delete</span>
    </button>

    <button class="spectrum-Button spectrum-Button--outline spectrum-Button--negative spectrum-Button--sizeXL spectrum-Button--iconOnly" aria-label="Delete">
      <svg class="spectrum-Icon spectrum-Icon--sizeXL" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-icon-18-Delete" />
      </svg>
    </button>
  </div>
</div>

Outline - Disabled
Contribution

Show markup
<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--outline spectrum-Button--negative" disabled>
  <span class="spectrum-Button-label">Delete</span>
</button>

<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--outline spectrum-Button--negative" disabled>
  <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
    <use xlink:href="#spectrum-icon-18-Delete" />
  </svg>
  <span class="spectrum-Button-label">Delete</span>
</button>

<button class="spectrum-Button spectrum-Button--sizeM spectrum-Button--outline spectrum-Button--negative spectrum-Button--iconOnly" disabled>
  <svg class="spectrum-Icon spectrum-Icon--sizeS" focusable="false" aria-hidden="true">
    <use xlink:href="#spectrum-icon-18-Delete" />
  </svg>
</button>

Custom Properties API


This component can be modified via its --mod-* prefixed custom properties. A list of those prefixed custom properties can be found here.

Migration Guide


Fill or Outline class required

All buttons now require either the .spectrum-Button--fill or .spectrum-Button--outline class.

Negative replaced by Negative with Outline

Replace all .spectrum-Button--negative with .spectrum-Button--negative .spectrum-Button--outline.

Negative Quiet replaced by Negative with Outline

Replace all .spectrum-Button--negative .spectrum-Button--quiet with .spectrum-Button--negative .spectrum-Button--outline.

Icon Only

Add the .spectrum-Button--iconOnly class to apply the correct styling when an icon is used without a label.
Provide an aria-label on the button itself when using this variant for accessibility.

T-shirt sizing

Button now supports t-shirt sizing and requires that you specify the size of button by adding a .spectrum-Button--size* class.

Change workflow icon size

Previously, all Buttons used .spectrum-Icon--sizeS. This has changed:

Button classname Workflow icon classname
.spectrum-Button--sizeS .spectrum-Icon--sizeS
.spectrum-Button--sizeM .spectrum-Icon--sizeM
.spectrum-Button--sizeL .spectrum-Icon--sizeL
.spectrum-Button--sizeXL .spectrum-Icon--sizeXL

Remove focus-ring class

We’ve migrated away from the focus-ring class in favor of the native :focus-visible pseudo-class due to changes in browser support.