Skip to content

Commit c4432c9

Browse files
committed
docs(button): update clear-button details
1 parent 86eb265 commit c4432c9

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

.changeset/hot-cups-report.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
---
2+
'@spectrum-web-components/button': patch
23
'@spectrum-web-components/clear-button': patch
34
'@spectrum-web-components/styles': patch
45
---
56

6-
More details forthcoming
7+
Clear button styles have been updated to the latest Spectrum CSS version of the clear button.
8+
9+
As the updated styles now offer additional styling options, we have added the following API to the clear button:
10+
11+
- `quiet` - when set to true, the button will be rendered as a quiet button. This is useful for cases where you want to use the clear button in a more subtle way.
12+
- `disabled` - when set to true, the button will be rendered as a disabled button.
13+
- `static-color` - currently this only supports the `white` context color. This is useful for cases where the button appears on a dark background texture. This is a replacement for the previously used `variant="overBackground"` attribute which is deprecated.
14+
15+
### Deprecation
16+
17+
The `variant="overBackground"` attribute is deprecated; please use the new `static-color="white"` attribute instead. When this property is used in the component, a deprecation warning will be shown in the console when in debug mode. The `variant` attribute will be removed in a future release.

packages/button/clear-button.md

+16
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ The label for an `<sp-clear-button>` element can be set via it's default slot or
9494
</sp-tab-panel>
9595
</sp-tabs>
9696

97+
#### Quiet
98+
99+
The `quiet` attribute will render the `<sp-clear-button>` as a quiet button. This is useful for cases where you want to use the clear button in a more subtle way.
100+
101+
```html
102+
<sp-clear-button quiet label="Clear content"></sp-clear-button>
103+
```
104+
105+
#### Static color
106+
107+
The `static-color` attribute will render the `<sp-clear-button>` with a static color. This is useful for cases where the button appears on a dark background texture. This is a replacement for the previously used `variant="overBackground"` attribute which is deprecated.
108+
109+
```html
110+
<sp-clear-button static-color="white" label="Clear content"></sp-clear-button>
111+
```
112+
97113
### States
98114

99115
In addition to the variant, the `<sp-clear-button>` elements supports a disabled state, which can be applied by adding the attribute `disabled`.

packages/button/src/ClearButton.ts

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class ClearButton extends SizedMixin(StyledButton, {
6464
return [...super.styles, buttonStyles, crossMediumStyles];
6565
}
6666

67+
@property({ type: Boolean, reflect: true })
68+
public quiet = false;
69+
6770
/**
6871
* The visual variant to apply to this button.
6972
* @deprecated Use `static-color='white'` instead.

packages/button/test/clear-button.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ governing permissions and limitations under the License.
1313
import '@spectrum-web-components/button/sp-clear-button.js';
1414
import { ClearButton } from '@spectrum-web-components/button';
1515
import { ElementSize } from '@spectrum-web-components/base';
16-
import { expect, fixture, html } from '@open-wc/testing';
16+
import { elementUpdated, expect, fixture, html } from '@open-wc/testing';
1717
import { testForLitDevWarnings } from '../../../test/testing-helpers';
18+
import { SinonStub, stub } from 'sinon';
1819

1920
describe('Clear Button', () => {
2021
testForLitDevWarnings(

0 commit comments

Comments
 (0)