From 0760bc02430245297cd659829586dd607860c52a Mon Sep 17 00:00:00 2001 From: amandaesmith333 Date: Wed, 14 Jun 2023 13:44:34 -0500 Subject: [PATCH 1/6] add playgrounds --- docs/api/select.md | 18 +++++++ .../custom-toggle-icons/angular.md | 11 ++++ .../custom-toggle-icons/demo.html | 30 +++++++++++ .../custom-toggle-icons/index.md | 13 +++++ .../custom-toggle-icons/javascript.md | 11 ++++ .../custom-toggle-icons/react.md | 18 +++++++ .../customization/custom-toggle-icons/vue.md | 22 ++++++++ .../angular/example_component_css.md | 13 +++++ .../angular/example_component_html.md | 18 +++++++ .../angular/example_component_ts.md | 10 ++++ .../icon-flip-behavior/demo.html | 51 +++++++++++++++++++ .../customization/icon-flip-behavior/index.md | 34 +++++++++++++ .../icon-flip-behavior/javascript.md | 32 ++++++++++++ .../icon-flip-behavior/react/main_css.md | 13 +++++ .../icon-flip-behavior/react/main_tsx.md | 28 ++++++++++ .../customization/icon-flip-behavior/vue.md | 43 ++++++++++++++++ 16 files changed, 365 insertions(+) create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/angular.md create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/demo.html create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/index.md create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/javascript.md create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/react.md create mode 100644 static/usage/v7/select/customization/custom-toggle-icons/vue.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_css.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_html.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_ts.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/demo.html create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/index.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/javascript.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/react/main_css.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/react/main_tsx.md create mode 100644 static/usage/v7/select/customization/icon-flip-behavior/vue.md diff --git a/docs/api/select.md b/docs/api/select.md index 2636e7d04bb..9c336ae37f4 100644 --- a/docs/api/select.md +++ b/docs/api/select.md @@ -180,6 +180,24 @@ Customizing the interface dialog should be done by following the Customization s However, the Select Option does set a class for easier styling and allows for the ability to pass a class to the overlay option, see the [Select Options documentation](select-option.md) for usage examples of customizing options. +### Custom Toggle Icons + +The icon that displays next to the select text can be set to any [Ionicon](https://ionic.io/ionicons) using the `toggleIcon` and/or `toggleIconWhenOpen` properties. + +import CustomToggleIconsExample from '@site/static/usage/v7/select/customization/custom-toggle-icons/index.md'; + + + +### Icon Flip Behavior + +By default, when the select is open, the toggle icon will automatically rotate on `md` mode and remain static on `ios` mode. This behavior can be customized using CSS. + +The below example also uses a [custom `toggleIcon`](#custom-toggle-icons) to better demonstrate the flip behavior on `ios`, since the default icon is vertically symmetrical. + +import IconFlipBehaviorExample from '@site/static/usage/v7/select/customization/icon-flip-behavior/index.md'; + + + ## Typeahead Component Typeahead or autocomplete functionality can be built using existing Ionic components. We recommend using an `ion-modal` to make the best use of the available screen space. diff --git a/static/usage/v7/select/customization/custom-toggle-icons/angular.md b/static/usage/v7/select/customization/custom-toggle-icons/angular.md new file mode 100644 index 00000000000..9c06a09bdab --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/angular.md @@ -0,0 +1,11 @@ +```html + + + + Apples + Oranges + Bananas + + + +``` diff --git a/static/usage/v7/select/customization/custom-toggle-icons/demo.html b/static/usage/v7/select/customization/custom-toggle-icons/demo.html new file mode 100644 index 00000000000..e743ad209c4 --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/demo.html @@ -0,0 +1,30 @@ + + + + + + Select - Custom Toggle Icons + + + + + + + + + +
+ + + + Apples + Oranges + Bananas + + + +
+
+
+ + diff --git a/static/usage/v7/select/customization/custom-toggle-icons/index.md b/static/usage/v7/select/customization/custom-toggle-icons/index.md new file mode 100644 index 00000000000..f36fc25b9e2 --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/index.md @@ -0,0 +1,13 @@ +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/select/customization/custom-toggle-icons/javascript.md b/static/usage/v7/select/customization/custom-toggle-icons/javascript.md new file mode 100644 index 00000000000..9d203201be9 --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/javascript.md @@ -0,0 +1,11 @@ +```html + + + + Apples + Oranges + Bananas + + + +``` diff --git a/static/usage/v7/select/customization/custom-toggle-icons/react.md b/static/usage/v7/select/customization/custom-toggle-icons/react.md new file mode 100644 index 00000000000..e423ec925c3 --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/react.md @@ -0,0 +1,18 @@ +```tsx +import React from 'react'; +import { IonItem, IonList, IonSelect, IonSelectOption } from '@ionic/react'; +function Example() { + return ( + + + + Apples + Oranges + Bananas + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/select/customization/custom-toggle-icons/vue.md b/static/usage/v7/select/customization/custom-toggle-icons/vue.md new file mode 100644 index 00000000000..47601fecd44 --- /dev/null +++ b/static/usage/v7/select/customization/custom-toggle-icons/vue.md @@ -0,0 +1,22 @@ +```html + + + +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_css.md b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_css.md new file mode 100644 index 00000000000..29a768fc54a --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_css.md @@ -0,0 +1,13 @@ +```css +ion-select.always-flip::part(icon) { + transition: transform .15s cubic-bezier(.4, 0, .2, 1); +} + +ion-select.always-flip.select-expanded::part(icon) { + transform: rotate(180deg); +} + +ion-select.never-flip::part(icon) { + transform: none; +} +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_html.md b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_html.md new file mode 100644 index 00000000000..65b2eba7b23 --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_html.md @@ -0,0 +1,18 @@ +```html + + + + Apples + Oranges + Bananas + + + + + Apples + Oranges + Bananas + + + +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_ts.md b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_ts.md new file mode 100644 index 00000000000..4db53a836a9 --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/angular/example_component_ts.md @@ -0,0 +1,10 @@ +```ts +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-example', + templateUrl: 'example.component.html', + styleUrls: ['example.component.css'], +}) +export class ExampleComponent {} +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/demo.html b/static/usage/v7/select/customization/icon-flip-behavior/demo.html new file mode 100644 index 00000000000..518de10da8e --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/demo.html @@ -0,0 +1,51 @@ + + + + + + Select - Icon Flip Behavior + + + + + + + + + + + +
+ + + + Apples + Oranges + Bananas + + + + + Apples + Oranges + Bananas + + + +
+
+
+ + diff --git a/static/usage/v7/select/customization/icon-flip-behavior/index.md b/static/usage/v7/select/customization/icon-flip-behavior/index.md new file mode 100644 index 00000000000..01371efba3c --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/index.md @@ -0,0 +1,34 @@ +import Playground from '@site/src/components/global/Playground'; + +import javascript from './javascript.md'; +import vue from './vue.md'; + +import react_main_tsx from './react/main_tsx.md'; +import react_main_css from './react/main_css.md'; + +import angular_example_component_html from './angular/example_component_html.md'; +import angular_example_component_css from './angular/example_component_css.md'; +import angular_example_component_ts from './angular/example_component_ts.md'; + + diff --git a/static/usage/v7/select/customization/icon-flip-behavior/javascript.md b/static/usage/v7/select/customization/icon-flip-behavior/javascript.md new file mode 100644 index 00000000000..9cc7a984b22 --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/javascript.md @@ -0,0 +1,32 @@ +```html + + + + Apples + Oranges + Bananas + + + + + Apples + Oranges + Bananas + + + + + +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/react/main_css.md b/static/usage/v7/select/customization/icon-flip-behavior/react/main_css.md new file mode 100644 index 00000000000..29a768fc54a --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/react/main_css.md @@ -0,0 +1,13 @@ +```css +ion-select.always-flip::part(icon) { + transition: transform .15s cubic-bezier(.4, 0, .2, 1); +} + +ion-select.always-flip.select-expanded::part(icon) { + transform: rotate(180deg); +} + +ion-select.never-flip::part(icon) { + transform: none; +} +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/react/main_tsx.md b/static/usage/v7/select/customization/icon-flip-behavior/react/main_tsx.md new file mode 100644 index 00000000000..d352279a9ca --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/react/main_tsx.md @@ -0,0 +1,28 @@ +```tsx +import React from 'react'; +import { IonItem, IonList, IonSelect, IonSelectOption } from '@ionic/react'; + +import './main.css'; + +function Example() { + return ( + + + + Apples + Oranges + Bananas + + + + + Apples + Oranges + Bananas + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/select/customization/icon-flip-behavior/vue.md b/static/usage/v7/select/customization/icon-flip-behavior/vue.md new file mode 100644 index 00000000000..830c49e76cd --- /dev/null +++ b/static/usage/v7/select/customization/icon-flip-behavior/vue.md @@ -0,0 +1,43 @@ +```html + + + + + +``` From 19e8ed28a3904acbbf0e570991fe45d0c685ab21 Mon Sep 17 00:00:00 2001 From: amandaesmith333 Date: Wed, 14 Jun 2023 13:46:13 -0500 Subject: [PATCH 2/6] lint --- .../custom-toggle-icons/angular.md | 8 +++++++- .../custom-toggle-icons/demo.html | 8 +++++++- .../custom-toggle-icons/javascript.md | 8 +++++++- .../customization/custom-toggle-icons/react.md | 8 +++++++- .../customization/custom-toggle-icons/vue.md | 8 +++++++- .../angular/example_component_css.md | 2 +- .../angular/example_component_html.md | 16 ++++++++++++++-- .../customization/icon-flip-behavior/demo.html | 18 +++++++++++++++--- .../icon-flip-behavior/javascript.md | 18 +++++++++++++++--- .../icon-flip-behavior/react/main_css.md | 2 +- .../icon-flip-behavior/react/main_tsx.md | 16 ++++++++++++++-- .../customization/icon-flip-behavior/vue.md | 18 +++++++++++++++--- 12 files changed, 110 insertions(+), 20 deletions(-) diff --git a/static/usage/v7/select/customization/custom-toggle-icons/angular.md b/static/usage/v7/select/customization/custom-toggle-icons/angular.md index 9c06a09bdab..2b96cb06c76 100644 --- a/static/usage/v7/select/customization/custom-toggle-icons/angular.md +++ b/static/usage/v7/select/customization/custom-toggle-icons/angular.md @@ -1,7 +1,13 @@ ```html - + Apples Oranges Bananas diff --git a/static/usage/v7/select/customization/custom-toggle-icons/demo.html b/static/usage/v7/select/customization/custom-toggle-icons/demo.html index e743ad209c4..065b5bb58c0 100644 --- a/static/usage/v7/select/customization/custom-toggle-icons/demo.html +++ b/static/usage/v7/select/customization/custom-toggle-icons/demo.html @@ -16,7 +16,13 @@
- + Apples Oranges Bananas diff --git a/static/usage/v7/select/customization/custom-toggle-icons/javascript.md b/static/usage/v7/select/customization/custom-toggle-icons/javascript.md index 9d203201be9..55d1fba878f 100644 --- a/static/usage/v7/select/customization/custom-toggle-icons/javascript.md +++ b/static/usage/v7/select/customization/custom-toggle-icons/javascript.md @@ -1,7 +1,13 @@ ```html - + Apples Oranges Bananas diff --git a/static/usage/v7/select/customization/custom-toggle-icons/react.md b/static/usage/v7/select/customization/custom-toggle-icons/react.md index e423ec925c3..e324650e88b 100644 --- a/static/usage/v7/select/customization/custom-toggle-icons/react.md +++ b/static/usage/v7/select/customization/custom-toggle-icons/react.md @@ -5,7 +5,13 @@ function Example() { return ( - + Apples Oranges Bananas diff --git a/static/usage/v7/select/customization/custom-toggle-icons/vue.md b/static/usage/v7/select/customization/custom-toggle-icons/vue.md index 47601fecd44..c0bcbd208e2 100644 --- a/static/usage/v7/select/customization/custom-toggle-icons/vue.md +++ b/static/usage/v7/select/customization/custom-toggle-icons/vue.md @@ -2,7 +2,13 @@