diff --git a/docs/api/select.md b/docs/api/select.md index 3b52ae2c23a..4f6cd7fa937 100644 --- a/docs/api/select.md +++ b/docs/api/select.md @@ -187,7 +187,7 @@ In most cases, [Icon](./icon.md) components placed in these slots should have `a If slot content is meant to be interacted with, it should be wrapped in an interactive element such as a [Button](./button.md). This ensures that the content can be tabbed to. ::: -import StartEndSlots from '@site/static/usage/v7/select/start-end-slots/index.md'; +import StartEndSlots from '@site/static/usage/v8/select/start-end-slots/index.md'; diff --git a/static/usage/v7/select/start-end-slots/angular.md b/static/usage/v7/select/start-end-slots/angular/example_component_html.md similarity index 100% rename from static/usage/v7/select/start-end-slots/angular.md rename to static/usage/v7/select/start-end-slots/angular/example_component_html.md diff --git a/static/usage/v7/select/start-end-slots/angular/example_component_ts.md b/static/usage/v7/select/start-end-slots/angular/example_component_ts.md new file mode 100644 index 00000000000..f7717b55dc1 --- /dev/null +++ b/static/usage/v7/select/start-end-slots/angular/example_component_ts.md @@ -0,0 +1,22 @@ +```ts +import { Component } from '@angular/core'; + +import { addIcons } from 'ionicons'; +import { eye, leaf } from 'ionicons/icons'; + +@Component({ + selector: 'app-example', + templateUrl: 'example.component.html', + styleUrls: ['example.component.css'], +}) +export class ExampleComponent { + constructor() { + /** + * Any icons you want to use in your application + * can be registered in app.component.ts and then + * referenced by name anywhere in your application. + */ + addIcons({ eye, leaf }); + } +} +``` diff --git a/static/usage/v7/select/start-end-slots/demo.html b/static/usage/v7/select/start-end-slots/demo.html index a8a6b13bd9d..19070edb419 100644 --- a/static/usage/v7/select/start-end-slots/demo.html +++ b/static/usage/v7/select/start-end-slots/demo.html @@ -4,10 +4,16 @@ Select - - + + + + diff --git a/static/usage/v7/select/start-end-slots/index.md b/static/usage/v7/select/start-end-slots/index.md index 7dea970c230..970141a94af 100644 --- a/static/usage/v7/select/start-end-slots/index.md +++ b/static/usage/v7/select/start-end-slots/index.md @@ -1,18 +1,38 @@ import Playground from '@site/src/components/global/Playground'; -import javascript from './javascript.md'; +import javascript_index_html from './javascript/index_html.md'; +import javascript_index_ts from './javascript/index_ts.md'; + import react from './react.md'; import vue from './vue.md'; -import angular from './angular.md'; + +import angular_example_component_html from './angular/example_component_html.md'; +import angular_example_component_ts from './angular/example_component_ts.md'; diff --git a/static/usage/v7/select/start-end-slots/javascript.md b/static/usage/v7/select/start-end-slots/javascript/index_html.md similarity index 100% rename from static/usage/v7/select/start-end-slots/javascript.md rename to static/usage/v7/select/start-end-slots/javascript/index_html.md diff --git a/static/usage/v7/select/start-end-slots/javascript/index_ts.md b/static/usage/v7/select/start-end-slots/javascript/index_ts.md new file mode 100644 index 00000000000..7d95af3a26b --- /dev/null +++ b/static/usage/v7/select/start-end-slots/javascript/index_ts.md @@ -0,0 +1,35 @@ +```ts +import { defineCustomElements } from '@ionic/core/loader'; + +import { addIcons } from 'ionicons'; +import { eye, leaf } from 'ionicons/icons'; + +/* Core CSS required for Ionic components to work properly */ +import '@ionic/core/css/core.css'; + +/* Basic CSS for apps built with Ionic */ +import '@ionic/core/css/normalize.css'; +import '@ionic/core/css/structure.css'; +import '@ionic/core/css/typography.css'; + +/* Optional CSS utils that can be commented out */ +import '@ionic/core/css/padding.css'; +import '@ionic/core/css/float-elements.css'; +import '@ionic/core/css/text-alignment.css'; +import '@ionic/core/css/text-transformation.css'; +import '@ionic/core/css/flex-utils.css'; +import '@ionic/core/css/display.css'; + +/* Theme variables */ +import './theme/variables.css'; + +/** + * On Ionicons 7.2+ these icons + * get mapped to a kebab-case key. + * Alternatively, developers can do: + * addIcons({ 'eye': eye, 'leaf': leaf }); + */ +addIcons({ eye, leaf }); + +defineCustomElements(); +``` diff --git a/static/usage/v8/select/start-end-slots/angular/example_component_html.md b/static/usage/v8/select/start-end-slots/angular/example_component_html.md new file mode 100644 index 00000000000..e42b896605c --- /dev/null +++ b/static/usage/v8/select/start-end-slots/angular/example_component_html.md @@ -0,0 +1,15 @@ +```html + + + + + Apple + Banana + Orange + + + + + + +``` diff --git a/static/usage/v8/select/start-end-slots/angular/example_component_ts.md b/static/usage/v8/select/start-end-slots/angular/example_component_ts.md new file mode 100644 index 00000000000..f7717b55dc1 --- /dev/null +++ b/static/usage/v8/select/start-end-slots/angular/example_component_ts.md @@ -0,0 +1,22 @@ +```ts +import { Component } from '@angular/core'; + +import { addIcons } from 'ionicons'; +import { eye, leaf } from 'ionicons/icons'; + +@Component({ + selector: 'app-example', + templateUrl: 'example.component.html', + styleUrls: ['example.component.css'], +}) +export class ExampleComponent { + constructor() { + /** + * Any icons you want to use in your application + * can be registered in app.component.ts and then + * referenced by name anywhere in your application. + */ + addIcons({ eye, leaf }); + } +} +``` diff --git a/static/usage/v8/select/start-end-slots/demo.html b/static/usage/v8/select/start-end-slots/demo.html new file mode 100644 index 00000000000..72885a6b03c --- /dev/null +++ b/static/usage/v8/select/start-end-slots/demo.html @@ -0,0 +1,40 @@ + + + + + + Select + + + + + + + + + + + +
+ + + + + Apple + Banana + Orange + + + + + + +
+
+
+ + diff --git a/static/usage/v8/select/start-end-slots/index.md b/static/usage/v8/select/start-end-slots/index.md new file mode 100644 index 00000000000..16512ed3369 --- /dev/null +++ b/static/usage/v8/select/start-end-slots/index.md @@ -0,0 +1,38 @@ +import Playground from '@site/src/components/global/Playground'; + +import javascript_index_html from './javascript/index_html.md'; +import javascript_index_ts from './javascript/index_ts.md'; + +import react from './react.md'; +import vue from './vue.md'; + +import angular_example_component_html from './angular/example_component_html.md'; +import angular_example_component_ts from './angular/example_component_ts.md'; + + diff --git a/static/usage/v8/select/start-end-slots/javascript/index_html.md b/static/usage/v8/select/start-end-slots/javascript/index_html.md new file mode 100644 index 00000000000..78d136d6a6a --- /dev/null +++ b/static/usage/v8/select/start-end-slots/javascript/index_html.md @@ -0,0 +1,15 @@ +```html + + + + + Apple + Banana + Orange + + + + + + +``` diff --git a/static/usage/v8/select/start-end-slots/javascript/index_ts.md b/static/usage/v8/select/start-end-slots/javascript/index_ts.md new file mode 100644 index 00000000000..c478e5fa9b4 --- /dev/null +++ b/static/usage/v8/select/start-end-slots/javascript/index_ts.md @@ -0,0 +1,46 @@ +```ts +import { defineCustomElements } from '@ionic/core/loader'; + +import { addIcons } from 'ionicons'; +import { eye, leaf } from 'ionicons/icons'; + +/* Core CSS required for Ionic components to work properly */ +import '@ionic/core/css/core.css'; + +/* Basic CSS for apps built with Ionic */ +import '@ionic/core/css/normalize.css'; +import '@ionic/core/css/structure.css'; +import '@ionic/core/css/typography.css'; + +/* Optional CSS utils that can be commented out */ +import '@ionic/core/css/padding.css'; +import '@ionic/core/css/float-elements.css'; +import '@ionic/core/css/text-alignment.css'; +import '@ionic/core/css/text-transformation.css'; +import '@ionic/core/css/flex-utils.css'; +import '@ionic/core/css/display.css'; + +/** + * Ionic Dark Theme + * ----------------------------------------------------- + * For more information, please see: + * https://ionicframework.com/docs/theming/dark-mode + */ + +// import '@ionic/core/css/palettes/dark.always.css'; +// import '@ionic/core/css/palettes/dark.class.css'; +import '@ionic/core/css/palettes/dark.system.css'; + +/* Theme variables */ +import './theme/variables.css'; + +/** + * On Ionicons 7.2+ these icons + * get mapped to a kebab-case key. + * Alternatively, developers can do: + * addIcons({ 'eye': eye, 'leaf': leaf }); + */ +addIcons({ eye, leaf }); + +defineCustomElements(); +``` diff --git a/static/usage/v8/select/start-end-slots/react.md b/static/usage/v8/select/start-end-slots/react.md new file mode 100644 index 00000000000..98bbf6208d7 --- /dev/null +++ b/static/usage/v8/select/start-end-slots/react.md @@ -0,0 +1,24 @@ +```tsx +import React from 'react'; +import { IonButton, IonIcon, IonItem, IonList, IonSelect, IonSelectOption } from '@ionic/react'; +import { eye, leaf } from 'ionicons/icons'; + +function Example() { + return ( + + + + + Apple + Banana + Orange + + + + + + + ); +} +export default Example; +``` diff --git a/static/usage/v8/select/start-end-slots/vue.md b/static/usage/v8/select/start-end-slots/vue.md new file mode 100644 index 00000000000..37882998e57 --- /dev/null +++ b/static/usage/v8/select/start-end-slots/vue.md @@ -0,0 +1,37 @@ +```html + + + +``` diff --git a/versioned_docs/version-v7/api/select.md b/versioned_docs/version-v7/api/select.md index c583a8a1b7e..b664bec16cd 100644 --- a/versioned_docs/version-v7/api/select.md +++ b/versioned_docs/version-v7/api/select.md @@ -175,6 +175,20 @@ import InterfaceOptionsExample from '@site/static/usage/v7/select/customization/ +## Start and End Slots + +The `start` and `end` slots can be used to place icons, buttons, or prefix/suffix text on either side of the select. If the slot content is clicked, the select will not open. + +:::note +In most cases, [Icon](./icon.md) components placed in these slots should have `aria-hidden="true"`. See the [Icon accessibility docs](https://ionicframework.com/docs/api/icon#accessibility) for more information. + +If slot content is meant to be interacted with, it should be wrapped in an interactive element such as a [Button](./button.md). This ensures that the content can be tabbed to. +::: + +import StartEndSlots from '@site/static/usage/v7/select/start-end-slots/index.md'; + + + ## Customization There are two units that make up the Select component and each need to be styled separately. The `ion-select` element is represented on the view by the selected value(s), or placeholder if there is none, and dropdown icon. The interface, which is defined in the [Interfaces](#interfaces) section above, is the dialog that opens when clicking on the `ion-select`. The interface contains all of the options defined by adding `ion-select-option` elements. The following sections will go over the differences between styling these.