mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
Use margin for <wa-icon> spacing in native buttons (#1197)
This commit is contained in:
@@ -380,6 +380,19 @@ Add the `wa-pill` class to give buttons rounded edges.
|
||||
<button class="wa-pill">Pill button</button>
|
||||
```
|
||||
|
||||
When using `<wa-icon>` within a button, wrap adjacent label text in `<span>` or similar to automatically add margin between the icon and the label, just like the `start` and `end` slots of `<wa-button>`.
|
||||
|
||||
```html {.example}
|
||||
<button>
|
||||
<wa-icon name="plane-departure"></wa-icon>
|
||||
<span>Start Icon</span>
|
||||
</button>
|
||||
<button>
|
||||
<span>End Icon</span>
|
||||
<wa-icon name="plane-arrival"></wa-icon>
|
||||
</button>
|
||||
```
|
||||
|
||||
### Form controls
|
||||
|
||||
Create a variety of form controls with `<input type="">`, `<select>`, and `<textarea>`. Each control closely matches the appearance of the corresponding Web Awesome component.
|
||||
|
||||
@@ -564,7 +564,6 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5em;
|
||||
|
||||
height: var(--wa-form-control-height);
|
||||
padding: 0 var(--wa-form-control-padding-inline);
|
||||
@@ -709,6 +708,16 @@
|
||||
&.wa-pill {
|
||||
border-radius: var(--wa-border-radius-pill);
|
||||
}
|
||||
|
||||
/* Adds space between icons and adjacent elements
|
||||
* Prefer sibling selectors over :first-child/:last-child to avoid extra space when an icon is used alone */
|
||||
& > wa-icon:has(+ *) {
|
||||
margin-inline-end: 0.75em;
|
||||
}
|
||||
|
||||
& > * + wa-icon {
|
||||
margin-inline-start: 0.75em;
|
||||
}
|
||||
}
|
||||
/* #endregion */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user