From c6e28d7e941ed107f2af0e3647d2ff13cbf4a661 Mon Sep 17 00:00:00 2001 From: amandaesmith333 Date: Tue, 9 May 2023 13:46:53 -0500 Subject: [PATCH 1/5] migrate labelPlacement playground to use label prop --- static/usage/v7/range/labels/angular.md | 12 +++--------- static/usage/v7/range/labels/demo.html | 20 +++++++------------- static/usage/v7/range/labels/javascript.md | 12 +++--------- static/usage/v7/range/labels/react.md | 12 +++--------- static/usage/v7/range/labels/vue.md | 12 +++--------- 5 files changed, 19 insertions(+), 49 deletions(-) diff --git a/static/usage/v7/range/labels/angular.md b/static/usage/v7/range/labels/angular.md index 54964fa0d0c..45532c5f917 100644 --- a/static/usage/v7/range/labels/angular.md +++ b/static/usage/v7/range/labels/angular.md @@ -1,17 +1,11 @@ ```html - -
Label at the Start
-
+
- -
Label at the End
-
+
- -
Fixed Width Label
-
+ ``` diff --git a/static/usage/v7/range/labels/demo.html b/static/usage/v7/range/labels/demo.html index e4e1e0c57a4..b44cc98584e 100644 --- a/static/usage/v7/range/labels/demo.html +++ b/static/usage/v7/range/labels/demo.html @@ -20,21 +20,15 @@
- -
Label at the Start
-
- + +
- - -
Label at the End
-
- + + +
- - -
Fixed Width Label
-
+ +
diff --git a/static/usage/v7/range/labels/javascript.md b/static/usage/v7/range/labels/javascript.md index 1f08d5d29af..9ee164f7d4d 100644 --- a/static/usage/v7/range/labels/javascript.md +++ b/static/usage/v7/range/labels/javascript.md @@ -1,17 +1,11 @@ ```html - -
Label at the Start
-
+
- -
Label at the End
-
+
- -
Fixed Width Label
-
+ ``` diff --git a/static/usage/v7/range/labels/react.md b/static/usage/v7/range/labels/react.md index 3096d66ac6f..ef5563f178e 100644 --- a/static/usage/v7/range/labels/react.md +++ b/static/usage/v7/range/labels/react.md @@ -4,21 +4,15 @@ import { IonRange } from '@ionic/react'; function Example() { return ( <> - -
Label at the Start
-
+
- -
Label at the End
-
+
- -
Fixed Width Label
-
+ ); } diff --git a/static/usage/v7/range/labels/vue.md b/static/usage/v7/range/labels/vue.md index c5346470905..53b7932edb8 100644 --- a/static/usage/v7/range/labels/vue.md +++ b/static/usage/v7/range/labels/vue.md @@ -1,20 +1,14 @@ ```html + + + + + + + + +
+ +
+ Label with custom HTML +
+
+
+
+
+ + diff --git a/static/usage/v7/range/label-slot/index.md b/static/usage/v7/range/label-slot/index.md new file mode 100644 index 00000000000..f885a98ce72 --- /dev/null +++ b/static/usage/v7/range/label-slot/index.md @@ -0,0 +1,8 @@ +import Playground from '@site/src/components/global/Playground'; + +import javascript from './javascript.md'; +import react from './react.md'; +import vue from './vue.md'; +import angular from './angular.md'; + + diff --git a/static/usage/v7/range/label-slot/javascript.md b/static/usage/v7/range/label-slot/javascript.md new file mode 100644 index 00000000000..83ae393896e --- /dev/null +++ b/static/usage/v7/range/label-slot/javascript.md @@ -0,0 +1,7 @@ +```html + +
+ Label with custom HTML +
+
+``` diff --git a/static/usage/v7/range/label-slot/react.md b/static/usage/v7/range/label-slot/react.md new file mode 100644 index 00000000000..8a3e4a8a07d --- /dev/null +++ b/static/usage/v7/range/label-slot/react.md @@ -0,0 +1,14 @@ +```tsx +import React from 'react'; +import { IonRange, IonText } from '@ionic/react'; +function Example() { + return ( + +
+ Label with custom HTML +
+
+ ); +} +export default Example; +``` diff --git a/static/usage/v7/range/label-slot/vue.md b/static/usage/v7/range/label-slot/vue.md new file mode 100644 index 00000000000..56765cdd14d --- /dev/null +++ b/static/usage/v7/range/label-slot/vue.md @@ -0,0 +1,18 @@ +```html + + + +``` From faf17a0815ea1dd53b67d7f8b18b2a3db04e021e Mon Sep 17 00:00:00 2001 From: amandaesmith333 Date: Wed, 10 May 2023 09:33:51 -0500 Subject: [PATCH 4/5] rearrange label sections --- docs/api/range.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/api/range.md b/docs/api/range.md index c1f490057ba..bf81b81921f 100644 --- a/docs/api/range.md +++ b/docs/api/range.md @@ -22,19 +22,22 @@ The Range slider lets users select from a range of values by moving the slider k By default the Range slider has a minimum value of `0` and a maximum value of `100`. This can be configured with the `min` and `max` properties. -## Basic Usage +## Labels -import Basic from '@site/static/usage/v7/range/basic/index.md'; +Range has several options for supplying a label for the component: +- `label` property: used for plaintext labels +- `label` slot: used for custom HTML labels +- `aria-label`: used for ranges with no visible label - +### Label Placement -## Label Placement +The below demo shows how to use the `labelPlacement` property to change the position of the label relative to the range. While the `label` property is used here, `labelPlacement` can also be used with the `label` slot. import LabelsPlayground from '@site/static/usage/v7/range/labels/index.md'; -## Label Slot +### Label Slot While plaintext labels should be passed in via the `label` property, if custom HTML is needed, it can be passed through the `label` slot instead. @@ -42,6 +45,14 @@ import LabelSlotPlayground from '@site/static/usage/v7/range/label-slot/index.md +### No Visible Label + +If no visible label is needed, devs should still supply an `aria-label` so the range is accessible to screen readers. + +import Basic from '@site/static/usage/v7/range/basic/index.md'; + + + ## Decorations Decorative elements can be passed into the `start` or `end` slots of the range. This is useful for adding icons such as low volume or high volume icons. Since these elements are decorative, they should not be announced by assistive technology such as screen readers. From f0f61828032a1e8e59cc5ca93936f705ba354715 Mon Sep 17 00:00:00 2001 From: amandaesmith333 Date: Wed, 10 May 2023 10:28:39 -0500 Subject: [PATCH 5/5] rename basic playground to no-visible-label --- docs/api/range.md | 4 ++-- static/usage/v7/range/{basic => no-visible-label}/angular.md | 0 static/usage/v7/range/{basic => no-visible-label}/demo.html | 0 static/usage/v7/range/{basic => no-visible-label}/index.md | 2 +- .../usage/v7/range/{basic => no-visible-label}/javascript.md | 0 static/usage/v7/range/{basic => no-visible-label}/react.md | 0 static/usage/v7/range/{basic => no-visible-label}/vue.md | 0 7 files changed, 3 insertions(+), 3 deletions(-) rename static/usage/v7/range/{basic => no-visible-label}/angular.md (100%) rename static/usage/v7/range/{basic => no-visible-label}/demo.html (100%) rename static/usage/v7/range/{basic => no-visible-label}/index.md (83%) rename static/usage/v7/range/{basic => no-visible-label}/javascript.md (100%) rename static/usage/v7/range/{basic => no-visible-label}/react.md (100%) rename static/usage/v7/range/{basic => no-visible-label}/vue.md (100%) diff --git a/docs/api/range.md b/docs/api/range.md index bf81b81921f..be52a7b1fea 100644 --- a/docs/api/range.md +++ b/docs/api/range.md @@ -49,9 +49,9 @@ import LabelSlotPlayground from '@site/static/usage/v7/range/label-slot/index.md If no visible label is needed, devs should still supply an `aria-label` so the range is accessible to screen readers. -import Basic from '@site/static/usage/v7/range/basic/index.md'; +import NoVisibleLabel from '@site/static/usage/v7/range/no-visible-label/index.md'; - + ## Decorations diff --git a/static/usage/v7/range/basic/angular.md b/static/usage/v7/range/no-visible-label/angular.md similarity index 100% rename from static/usage/v7/range/basic/angular.md rename to static/usage/v7/range/no-visible-label/angular.md diff --git a/static/usage/v7/range/basic/demo.html b/static/usage/v7/range/no-visible-label/demo.html similarity index 100% rename from static/usage/v7/range/basic/demo.html rename to static/usage/v7/range/no-visible-label/demo.html diff --git a/static/usage/v7/range/basic/index.md b/static/usage/v7/range/no-visible-label/index.md similarity index 83% rename from static/usage/v7/range/basic/index.md rename to static/usage/v7/range/no-visible-label/index.md index 59922df7eda..f23fc3fd998 100644 --- a/static/usage/v7/range/basic/index.md +++ b/static/usage/v7/range/no-visible-label/index.md @@ -5,4 +5,4 @@ import react from './react.md'; import vue from './vue.md'; import angular from './angular.md'; - + diff --git a/static/usage/v7/range/basic/javascript.md b/static/usage/v7/range/no-visible-label/javascript.md similarity index 100% rename from static/usage/v7/range/basic/javascript.md rename to static/usage/v7/range/no-visible-label/javascript.md diff --git a/static/usage/v7/range/basic/react.md b/static/usage/v7/range/no-visible-label/react.md similarity index 100% rename from static/usage/v7/range/basic/react.md rename to static/usage/v7/range/no-visible-label/react.md diff --git a/static/usage/v7/range/basic/vue.md b/static/usage/v7/range/no-visible-label/vue.md similarity index 100% rename from static/usage/v7/range/basic/vue.md rename to static/usage/v7/range/no-visible-label/vue.md