add labels examples

pull/568/head
Cory LaViska 2021-10-14 08:34:54 -04:00
rodzic a2851370bb
commit 88cba353c0
3 zmienionych plików z 22 dodań i 6 usunięć

Wyświetl plik

@ -20,10 +20,18 @@ Use the `--height` custom property to set the progress bar's height.
### Labels
Use the default slot to show a label.
Use the `label` attribute to label the progress bar and tell assistive devices how to announce it.
```html preview
<sl-progress-bar value="50" class="progress-bar-labels">50%</sl-progress-bar>
<sl-progress-bar value="50" label="Upload progress"></sl-progress-bar>
```
### Showing Values
Use the default slot to show a value.
```html preview
<sl-progress-bar value="50" class="progress-bar-values">50%</sl-progress-bar>
<br>
@ -31,7 +39,7 @@ Use the default slot to show a label.
<sl-button circle><sl-icon name="plus"></sl-icon></sl-button>
<script>
const progressBar = document.querySelector('.progress-bar-labels');
const progressBar = document.querySelector('.progress-bar-values');
const subtractButton = progressBar.nextElementSibling.nextElementSibling;
const addButton = subtractButton.nextElementSibling;

Wyświetl plik

@ -42,10 +42,18 @@ To change the color, use the `--track-color` and `--indicator-color` custom prop
### Labels
Use the `label` attribute to label the progress ring and tell assistive devices how to announce it.
```html preview
<sl-progress-ring value="50" label="Upload progress"></sl-progress-ring>
```
### Showing Values
Use the default slot to show a label.
```html preview
<sl-progress-ring value="50" class="progress-ring-labels" style="margin-bottom: .5rem;">50%</sl-progress-ring>
<sl-progress-ring value="50" class="progress-ring-values" style="margin-bottom: .5rem;">50%</sl-progress-ring>
<br>
@ -53,7 +61,7 @@ Use the default slot to show a label.
<sl-button circle><sl-icon name="plus"></sl-icon></sl-button>
<script>
const progressRing = document.querySelector('.progress-ring-labels');
const progressRing = document.querySelector('.progress-ring-values');
const subtractButton = progressRing.nextElementSibling.nextElementSibling;
const addButton = subtractButton.nextElementSibling;

Wyświetl plik

@ -7,7 +7,7 @@
"license": "MIT",
"main": "dist/shoelace.js",
"module": "dist/shoelace.js",
"customElements": "dist/custom-elements.json",
"customElements": "docs/dist/custom-elements.json",
"type": "module",
"types": "dist/shoelace.d.ts",
"files": [