`
| `"suffix"` | Used to append an icon or similar element to the button. |
+## Dependencies
+
+### Depends on
+
+- [sl-icon](../icon)
+
+### Graph
+```mermaid
+graph TD;
+ sl-button --> sl-icon
+ style sl-button fill:#f9f,stroke:#333,stroke-width:4px
+```
+
----------------------------------------------
diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx
index 01738b8c1..277f477b9 100644
--- a/src/components/icon/icon.tsx
+++ b/src/components/icon/icon.tsx
@@ -2,6 +2,8 @@ import { Component, Prop, State, Watch, getAssetPath, h } from '@stencil/core';
import { requestIcon } from './request';
+const parser = new DOMParser();
+
@Component({
tag: 'sl-icon',
styleUrl: 'icon.scss',
@@ -20,6 +22,9 @@ export class Icon {
/** An alternative description to use for accessibility. If omitted, the name or src will be used to generate it. */
@Prop() label: string;
+ /** An alternative description to use for accessibility. If omitted, the name or src will be used to generate it. */
+ @Prop() strokeWidth = '2';
+
@Watch('name')
@Watch('src')
handleChange() {
@@ -46,10 +51,20 @@ export class Icon {
setIcon() {
const url = this.name ? getAssetPath(`./icons/${this.name}.svg`) : this.src;
- requestIcon(url).then(svg => (this.svg = svg));
+ requestIcon(url).then(source => {
+ const doc = parser.parseFromString(source, 'text/html');
+ const svg = doc.body.querySelector('svg');
+
+ if (svg) {
+ svg.setAttribute('stroke-width', this.strokeWidth);
+ this.svg = svg.outerHTML;
+ } else {
+ this.svg = '';
+ }
+ });
}
render() {
- return ;
+ return ;
}
}
diff --git a/src/components/icon/readme.md b/src/components/icon/readme.md
index b144c5b0f..71a151e99 100644
--- a/src/components/icon/readme.md
+++ b/src/components/icon/readme.md
@@ -1,33 +1,37 @@
# Icon
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+```html preview
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
-
+Icons are courtesy of [Feather Icons](https://feathericons.com/).
## Properties
-| Property | Attribute | Description | Type | Default |
-| -------- | --------- | ------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
-| `label` | `label` | An alternative description to use for accessibility. If omitted, the name or src will be used to generate it. | `string` | `undefined` |
-| `name` | `name` | The name of the icon to draw. | `string` | `undefined` |
-| `src` | `src` | An external URL of the SVG file to fetch. | `string` | `undefined` |
+| Property | Attribute | Description | Type | Default |
+| ------------- | -------------- | ------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
+| `label` | `label` | An alternative description to use for accessibility. If omitted, the name or src will be used to generate it. | `string` | `undefined` |
+| `name` | `name` | The name of the icon to draw. | `string` | `undefined` |
+| `src` | `src` | An external URL of the SVG file to fetch. | `string` | `undefined` |
+| `strokeWidth` | `stroke-width` | An alternative description to use for accessibility. If omitted, the name or src will be used to generate it. | `string` | `'2'` |
## Dependencies
@@ -35,6 +39,7 @@
### Used by
- [sl-alert](../alert)
+ - [sl-button](../button)
- [sl-dropdown-item](../dropdown-item)
- [sl-input](../input)
@@ -42,6 +47,7 @@
```mermaid
graph TD;
sl-alert --> sl-icon
+ sl-button --> sl-icon
sl-dropdown-item --> sl-icon
sl-input --> sl-icon
style sl-icon fill:#f9f,stroke:#333,stroke-width:4px
diff --git a/src/components/input/input.tsx b/src/components/input/input.tsx
index a8f9229c1..2a4414c96 100644
--- a/src/components/input/input.tsx
+++ b/src/components/input/input.tsx
@@ -191,12 +191,12 @@ export class Input {
>
{this.isPasswordVisible ? (
-
+
) : (
{' '}
-
+
)}
diff --git a/src/components/input/readme.md b/src/components/input/readme.md
index 3243fd201..94a236b65 100644
--- a/src/components/input/readme.md
+++ b/src/components/input/readme.md
@@ -15,21 +15,21 @@
-
+
-
+
-
+
@@ -59,7 +59,7 @@
$
.00
-
+
@@ -68,7 +68,7 @@
$
.00
-
+
@@ -77,7 +77,7 @@
$
.00
-
+
diff --git a/src/styles/mixins/button.scss b/src/styles/mixins/button.scss
index e8f08424a..181416779 100644
--- a/src/styles/mixins/button.scss
+++ b/src/styles/mixins/button.scss
@@ -16,7 +16,8 @@
background-color: $background-color;
border-color: $border-color;
color: $color;
- s &:hover:not(:disabled) {
+
+ &:hover:not(:disabled) {
background-color: $background-color--hover;
border-color: $border-color--hover;
color: $color--hover;