diff --git a/docs/api/input.md b/docs/api/input.md index 519963e4d9c..b4996e6afb4 100644 --- a/docs/api/input.md +++ b/docs/api/input.md @@ -85,6 +85,8 @@ Material Design offers filled styles for an input. The `fill` property on the in Since the `fill` styles visually defines the input container, inputs that use `fill` should not be used in `ion-item`. +Filled inputs can be used on iOS by setting Input's `mode` to `md`. + import Fill from '@site/static/usage/v7/input/fill/index.md'; diff --git a/docs/api/item.md b/docs/api/item.md index 6aaf0dd0609..913135eebad 100644 --- a/docs/api/item.md +++ b/docs/api/item.md @@ -8,6 +8,9 @@ import Parts from '@ionic-internal/component-api/v7/item/parts.md'; import CustomProps from '@ionic-internal/component-api/v7/item/custom-props.md'; import Slots from '@ionic-internal/component-api/v7/item/slots.md'; +import useBaseUrl from '@docusaurus/useBaseUrl'; +import BestPracticeFigure from '@components/global/BestPracticeFigure'; + ion-item: Input, Edit, or Delete iOS and Android Item Elements @@ -17,7 +20,8 @@ import EncapsulationPill from '@components/page/api/EncapsulationPill'; -Items are elements that can contain text, icons, avatars, images, inputs, and any other native or custom elements. Generally they are placed in a [list](./list) with other items. Items can be swiped, deleted, reordered, edited, and more. +Items are elements that can contain text, icons, avatars, images, inputs, and any other native or custom elements. Items should only be used as rows in a [List](./list) with other items. Items can be swiped, deleted, reordered, edited, and more. + ## Basic Usage @@ -28,6 +32,135 @@ import Basic from '@site/static/usage/v7/item/basic/index.md'; +## Content Types + +While items in a list take many forms, they typically support 5 different content types: supporting visuals, text, metadata, actions, and controls. However, not all of these content types should be used together at the same time. The following guide shows the different content types as well as how to properly utilize them in an application. + +### Supporting Visuals + +Supporting visuals are decorative icons or other adornments for an item. Common examples of supporting visuals are [Avatars](./avatar), [Icons](./icon), and [Thumbnails](./thumbnail). Since this content is not required to understand the intent of the item, it is typically hidden from screen readers using `aria-hidden="true"`. + +If a visual is required to interact with the item, such as an icon button, then the visual is an [action](#actions) not a supporting visual. + +} + dontImage={A list with several items. Each item has an icon and visible text describing the item. Some icons are rendered at the start of the line, and some icons are rendered at the end of the line} +/> + +In the example below, we are creating two lists with supporting visuals. The first list uses icons, and the second list uses avatars. The visuals are decorative, so they all have `aria-hidden="true"`. Additionally, they are presented consistently in the `start` slot. + +import SupportingVisuals from '@site/static/usage/v7/item/content-types/supporting-visuals/index.md'; + + + +### Text + +The text content type includes form control labels or other visible text. This text serves to indicate the intent of the item. Try to keep the text short and to the point. + +If you find that you need a few more sentences to clarify the item's purpose, consider moving the additional sentences to a Note at the bottom of the list. Adding the item to its own list makes it clear which item the text is associated with.} + doText="Move long text outside of the list" + dontText="Don't try to fit long text in an item" + doImage={A list with an item that contains a checked checkbox indicating the user wants to receive emails. Text describing how often the user will receive emails as well as how to unsubscribe from emails is placed underneath the list.} + dontImage={A list with an item that contains a checked checkbox indicating the user wants to receive emails. Text describing how often the user will receive emails as well as how to unsubscribe from emails is placed as a single paragraph inline with the checkbox, making the text hard to read and increasing the height of the item.} +/> + +In the example below, we are creating a list with different types of text. The "First Name" and "Last Name" labels serve to indicate what to type into the text inputs. + +The "Allow Notifications" label on the toggle has additional text underneath it that notes users can disable notifications. Since this text is short, it is placed inside of the item. + +Below that list is another list containing a textarea with a [Note](./note) containing long text underneath. The textarea was placed in its own list to make it apparent that the long text is associated with the textarea and not any other fields. + +import Text from '@site/static/usage/v7/item/content-types/text/index.md'; + + + +### Metadata + +Metadata provides additional context for an item such as status text or counts. Components like [Badge](./badge) or [Note](./note) are great ways of showing metadata. + +} + dontImage={A list that contains several items, each representing a different to-do list. Two counts are placed at the end of each item: One count that states the total number of tasks, and another count that states the total number of tasks that are due today.} +/> + +} + cautionImage={A list that contains several items, each representing a different to-do list. A count of how many tasks in each to-do list is placed at the end of each item. However, the count is highlighted in blue which draws the user's attention away from the name of the to-do list.} +/> + +In the example below, we are creating two lists with different kinds of metadata. The first list uses [Note](./note) to show how many tasks are in each to-do list. + +The second list mimics the iOS Mail app to show an inbox. This list makes use of custom metadata including an "unread message" indicator in the "start" slot as well as a timestamp and custom detail icon in the "end" slot. The "unread message" indicator is highlighted in blue to draw the user's attention to the unread messages, while the timestamp is more subtle. + +import Metadata from '@site/static/usage/v7/item/content-types/metadata/index.md'; + + + +### Actions + +Actions are interactive elements that do something when you activate them. An item can have multiple actions displayed on a line. However, developers should ensure that each action's tap target is large enough to be usable. + +Developers should avoid creating nested interactives which can break the user experience with screen readers. For example, developers should avoid adding a button inside the main content of the Item if the `button` property is set to `true`. + +Actions can be added by using the Item Sliding component. Actions can also be placed directly inside of the Item without the use of Item Sliding, but this should be limited to no more than 2 actions.} + doText={<>Use an Item Sliding to reveal multiple actions by swiping on the Item.} + dontText="Don't put more than 2 actions within an Item." + doImage={A list that contains several items, each representing a contact. Each item has text that states the contact's name as well as several actions including pinning the contact, sharing the contact, and deleting the contact. These actions are revealed by swiping on the item.} + dontImage={A list that contains several items, each representing a contact. Each item has text that states the contact's name as well as several actions including pinning the contact, sharing the contact, and deleting the contact. The actions are placed directly on the item. Since there are so many actions, some of the text is cut off.} +/> + +In the example below, we are creating a list of contacts. Each item is a stubbed button intended to bring you to the full contact page for that item. There are additional actions associated with each item that users can reveal by swiping on the item. + +import Actions from '@site/static/usage/v7/item/content-types/actions/index.md'; + + + +### Controls + +Controls are form components such as checkboxes, inputs, radios, and more. Each item in a list should have at most two controls due to screen space constraints. + +Metadata such as helper text or character counts should not be used on form controls in list views. If such metadata is needed, the form control should be placed outside of a list. Filled Inputs are a great way of visually defining the input container outside of a list.} + doText="Place inputs with metadata outside of the list." + dontText="Don't put metadata for inputs in the list." + doImage={There is an email input and a password input. Both have helper text associated with them. Since both are placed outside of a list it is clear which input each helper text is associated with.} + dontImage={There is a list containing an email input and a password input. Both have helper texts associated with them. However, the divider between each item and between the helper text makes it hard to tell which input each helper text is associated with.} +/> + +Alternatively, the metadata can be placed in a Note at the bottom of the list.} + doText="Place metadata for inputs at the end of a list." + dontText="Don't put metadata for inputs in the list." + doImage={There are two lists of inputs. The first list contains a password input. Below that list contains text that says 'Password must be at least 16 characters'. The second list contains an email input. This second list is separated so the password length requirement text is clearly associated with the password input above.} + dontImage={There is one list of inputs. One of the inputs is a password input with text below the input that says 'Password must be at least 16 characters'. However, this text is placed directly above another input, so it's not immediately clear which input the text is associated with.} +/> + +Items should typically have no more than two controls. If you need more controls, consider adding the additional controls in a Modal that is accessible from the item.} + doText="Move additional controls to a submenu accessible from the item." + dontText="Don't use more than two controls within an item." + doImage={There is one list of inputs. One of the inputs is a password input with text below the input that says 'Password must be at least 16 characters'. However, this text is placed directly above another input, so it's not immediately clear which input the text is associated with.} + dontImage={There are two lists of inputs. The first list contains a password input. Below that list contains text that says 'Password must be at least 16 characters'. The second list contains an email input. This second list is separated so the password length requirement text is clearly associated with the password input above.} +/> + +In the example below, we are creating a list of to-do tasks. Each item has a checkbox and an input. The checkbox lets the user mark a task as complete, and the input lets the user change the name of the task. + +import Controls from '@site/static/usage/v7/item/content-types/controls/index.md'; + + + + ## Clickable Items An item is considered "clickable" if it has an `href` or `button` property set. Clickable items have a few visual differences that indicate they can be interacted with. For example, a clickable item receives the ripple effect upon activation in `md` mode, has a highlight when activated in `ios` mode, and has a [detail arrow](#detail-arrows) by default in `ios` mode. @@ -69,16 +202,6 @@ import Lines from '@site/static/usage/v7/item/lines/index.md'; - -## Media Items - -[Avatars](./avatar) and [Thumbnails](./thumbnail) can be slotted inside of an item. This is useful when making lists of images and text. - -import Media from '@site/static/usage/v7/item/media/index.md'; - - - - ## Buttons in Items Buttons are styled smaller inside of items than when they are outside of them. To make the button size match buttons outside of an item, set the `size` attribute to `"default"`. @@ -87,14 +210,6 @@ import Buttons from '@site/static/usage/v7/item/buttons/index.md'; - -## Icons in Items - -import Icons from '@site/static/usage/v7/item/icons/index.md'; - - - - ## Item Inputs import Inputs from '@site/static/usage/v7/item/inputs/index.md'; @@ -132,6 +247,14 @@ import InputHighlight from '@site/static/usage/v7/item/theming/input-highlight/i +## Guidelines + +The following guidelines will help ensure your list items are easy to understand and use. + +1. Items should only be used inside of [Lists](./list). +2. Items inside of a list should be presented in a consistent format. For example, if your items present decorative icons, the icons should be positioned in the same way between items. +3. Items should never render [nested interactives](https://dequeuniversity.com/rules/axe/4.4/nested-interactive). Screen readers are unable to select the correct interactive element when nested interactives are used. For example, avoid placing a button inside of an `ion-item` that has `button="true"`. +4. Use [content types](#content-types) correctly. The Item component is designed to be a row in a [List](./list) and should not be used as a general purpose container. ## Properties diff --git a/docs/api/textarea.md b/docs/api/textarea.md index 8bc1d7ee99d..25c3328f4d0 100644 --- a/docs/api/textarea.md +++ b/docs/api/textarea.md @@ -69,6 +69,8 @@ Material Design offers filled styles for a textarea. The `fill` property on the Since the `fill` styles visually defines the textarea container, textareas that use `fill` should not be used in `ion-item`. +Filled textareas can be used on iOS by setting Textarea's `mode` to `md`. + import Fill from '@site/static/usage/v7/textarea/fill/index.md'; diff --git a/src/components/global/BestPracticeFigure/best-practice-figure.css b/src/components/global/BestPracticeFigure/best-practice-figure.css new file mode 100644 index 00000000000..140024cbf83 --- /dev/null +++ b/src/components/global/BestPracticeFigure/best-practice-figure.css @@ -0,0 +1,70 @@ +.best-practice__do_dont { + display: grid; + + grid-template-columns: 1fr 1fr; + + gap: 12px; +} + +/* Collapse to 1 column per row on smaller viewports */ +@media (max-width: 996px) { + .best-practice__do_dont { + grid-template-columns: 1fr; + } +} + +.best-practice__container figcaption { + text-align: start; +} + +.best-practice__do p, +.best-practice__dont p, +.best-practice__caution p { + padding: 8px 16px; +} + +.best-practice__image-wrapper { + border-radius: 8px 8px 0px 0px; + + overflow: hidden; +} + +.best-practice__dont-text, +.best-practice__do-text, +.best-practice__caution-text { + padding: 12px 16px; + + font-weight: 600; + + border-radius: 0px 0px 8px 8px; +} + +.best-practice__do .best-practice__image-wrapper { + border: 1px solid var(--c-blue-10); +} + +.best-practice__dont .best-practice__image-wrapper { + border: 1px solid var(--c-red-10); +} + +.best-practice__caution .best-practice__image-wrapper { + border: 1px solid var(--c-yellow-10); +} + +.best-practice__dont-text { + color: var(--c-red-100); + background: var(--c-red-10); +} +.best-practice__do-text { + color: var(--c-blue-100); + background: var(--c-blue-10); +} + +.best-practice__caution-text { + /* --c-yellow-100 does not have enough contrast + * placed on top of --c-yellow-10, so we manually + * choose a darker text color here. + */ + color: #7e5e17; + background: var(--c-yellow-10); +} diff --git a/src/components/global/BestPracticeFigure/index.tsx b/src/components/global/BestPracticeFigure/index.tsx new file mode 100644 index 00000000000..73e1eb7d91f --- /dev/null +++ b/src/components/global/BestPracticeFigure/index.tsx @@ -0,0 +1,82 @@ +import React from 'react'; + +import './best-practice-figure.css'; + +/** + Usage: + + import BestPracticeFigure from '@components/global/BestPracticeFigure'; + + } + dontImage={...} + /> + + All images must have alt text for screen readers. + + Custom HTML can also be passed to any of the text properties by using curly braces: + + text={<>My text with a link} + + Markdown such as backticks will not be processed when using curly braces. + The tag can be used instead: + + text={<>The button property} + + This component also supports a caution option. Typically you should use + either a "Don't" image or a "Caution" image but not both. + + } + cautionImage={...} + /> + + @prop text - Text that describes the figure as a whole + @prop doText - Text that describes a best practice + @prop dontText - Text that describes an anti-pattern + @prop cautionText - Text that describes something that could be an anti-pattern based on use case + @prop doImage - Image associated with doText + @prop dontImage - Image associated with dontText + @prop cautionImage - Image associated with cautionText + */ + +export default function BestPracticeFigure({ text, doText, dontText, cautionText, doImage, dontImage, cautionImage }) { + return ( +
+

{text}

+
+
+
{doImage}
+
+
Do
+

{doText}

+
+
+ {dontText && dontImage && ( +
+
{dontImage}
+
+
Don't
+

{dontText}

+
+
+ )} + {cautionText && cautionImage && ( +
+
{cautionImage}
+
+
Caution
+

{cautionText}

+
+
+ )} +
+
+ ); +} diff --git a/static/img/item/actions-do.jpg b/static/img/item/actions-do.jpg new file mode 100644 index 00000000000..2b186182c8b Binary files /dev/null and b/static/img/item/actions-do.jpg differ diff --git a/static/img/item/actions-dont.jpg b/static/img/item/actions-dont.jpg new file mode 100644 index 00000000000..1ff3bf8524f Binary files /dev/null and b/static/img/item/actions-dont.jpg differ diff --git a/static/img/item/controls-count-do.jpg b/static/img/item/controls-count-do.jpg new file mode 100644 index 00000000000..0648b81566d Binary files /dev/null and b/static/img/item/controls-count-do.jpg differ diff --git a/static/img/item/controls-count-dont.jpg b/static/img/item/controls-count-dont.jpg new file mode 100644 index 00000000000..a6c75a9e164 Binary files /dev/null and b/static/img/item/controls-count-dont.jpg differ diff --git a/static/img/item/controls-metadata-do.jpg b/static/img/item/controls-metadata-do.jpg new file mode 100644 index 00000000000..8d336ebf7aa Binary files /dev/null and b/static/img/item/controls-metadata-do.jpg differ diff --git a/static/img/item/controls-metadata-dont.jpg b/static/img/item/controls-metadata-dont.jpg new file mode 100644 index 00000000000..aed615b0c6c Binary files /dev/null and b/static/img/item/controls-metadata-dont.jpg differ diff --git a/static/img/item/controls-metadata-list-do.jpg b/static/img/item/controls-metadata-list-do.jpg new file mode 100644 index 00000000000..22ae86d7b97 Binary files /dev/null and b/static/img/item/controls-metadata-list-do.jpg differ diff --git a/static/img/item/controls-metadata-list-dont.jpg b/static/img/item/controls-metadata-list-dont.jpg new file mode 100644 index 00000000000..8b113a65304 Binary files /dev/null and b/static/img/item/controls-metadata-list-dont.jpg differ diff --git a/static/img/item/long-text-do.jpg b/static/img/item/long-text-do.jpg new file mode 100644 index 00000000000..21ff566540b Binary files /dev/null and b/static/img/item/long-text-do.jpg differ diff --git a/static/img/item/long-text-dont.jpg b/static/img/item/long-text-dont.jpg new file mode 100644 index 00000000000..23fea6bbfc5 Binary files /dev/null and b/static/img/item/long-text-dont.jpg differ diff --git a/static/img/item/metadata-important-caution.jpg b/static/img/item/metadata-important-caution.jpg new file mode 100644 index 00000000000..d64c18681e0 Binary files /dev/null and b/static/img/item/metadata-important-caution.jpg differ diff --git a/static/img/item/metadata-relevant-do.jpg b/static/img/item/metadata-relevant-do.jpg new file mode 100644 index 00000000000..c44cbaea719 Binary files /dev/null and b/static/img/item/metadata-relevant-do.jpg differ diff --git a/static/img/item/metadata-relevant-dont.jpg b/static/img/item/metadata-relevant-dont.jpg new file mode 100644 index 00000000000..6b4162a2f8c Binary files /dev/null and b/static/img/item/metadata-relevant-dont.jpg differ diff --git a/static/img/item/visuals-do.jpg b/static/img/item/visuals-do.jpg new file mode 100644 index 00000000000..76be3793fdd Binary files /dev/null and b/static/img/item/visuals-do.jpg differ diff --git a/static/img/item/visuals-dont.jpg b/static/img/item/visuals-dont.jpg new file mode 100644 index 00000000000..3718350c1a6 Binary files /dev/null and b/static/img/item/visuals-dont.jpg differ diff --git a/static/usage/v7/item/content-types/actions/angular.md b/static/usage/v7/item/content-types/actions/angular.md new file mode 100644 index 00000000000..f70c70b90c4 --- /dev/null +++ b/static/usage/v7/item/content-types/actions/angular.md @@ -0,0 +1,150 @@ +```html + + + Example + + + + + + + + Rick Astley + + + + + + + + + + + + + + + + + + Leeroy Jenkins + + + + + + + + + + + + + + + + + + Ionitron + + + + + + + + + + + + + + + + + + Wall-E + + + + + + + + + + + + + + + + + + Cortana + + + + + + + + + + + + + + + + + + Bender + + + + + + + + + + + + + + + + + + BB-8 + + + + + + + + + + + + + + + +``` diff --git a/static/usage/v7/item/content-types/actions/demo.html b/static/usage/v7/item/content-types/actions/demo.html new file mode 100644 index 00000000000..3a39123503f --- /dev/null +++ b/static/usage/v7/item/content-types/actions/demo.html @@ -0,0 +1,165 @@ + + + + + + Item + + + + + + + + + + + Example + + + + + + + + Rick Astley + + + + + + + + + + + + + + + + + + Leeroy Jenkins + + + + + + + + + + + + + + + + + + Ionitron + + + + + + + + + + + + + + + + + + Wall-E + + + + + + + + + + + + + + + + + + Cortana + + + + + + + + + + + + + + + + + + Bender + + + + + + + + + + + + + + + + + + BB-8 + + + + + + + + + + + + + + + + + + diff --git a/static/usage/v7/item/content-types/actions/index.md b/static/usage/v7/item/content-types/actions/index.md new file mode 100644 index 00000000000..d2977e414d2 --- /dev/null +++ b/static/usage/v7/item/content-types/actions/index.md @@ -0,0 +1,19 @@ +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/item/content-types/actions/javascript.md b/static/usage/v7/item/content-types/actions/javascript.md new file mode 100644 index 00000000000..5d9e403c93a --- /dev/null +++ b/static/usage/v7/item/content-types/actions/javascript.md @@ -0,0 +1,150 @@ +```html + + + Example + + + + + + + + Rick Astley + + + + + + + + + + + + + + + + + + Leeroy Jenkins + + + + + + + + + + + + + + + + + + Ionitron + + + + + + + + + + + + + + + + + + Wall-E + + + + + + + + + + + + + + + + + + Cortana + + + + + + + + + + + + + + + + + + Bender + + + + + + + + + + + + + + + + + + BB-8 + + + + + + + + + + + + + + + +``` diff --git a/static/usage/v7/item/content-types/actions/react.md b/static/usage/v7/item/content-types/actions/react.md new file mode 100644 index 00000000000..59699517fb9 --- /dev/null +++ b/static/usage/v7/item/content-types/actions/react.md @@ -0,0 +1,174 @@ +```tsx +import React from 'react'; +import { + IonAvatar, + IonContent, + IonHeader, + IonIcon, + IonItem, + IonItemOptions, + IonItemOption, + IonItemSliding, + IonLabel, + IonList, + IonTitle, + IonToolbar, +} from '@ionic/react'; +import { pin, share, trash } from 'ionicons/icons'; + +function Example() { + return ( + <> + + + Example + + + + + + + + Rick Astley + + + + + + + + + + + + + + + + + + Leeroy Jenkins + + + + + + + + + + + + + + + + + + Ionitron + + + + + + + + + + + + + + + + + + Wall-E + + + + + + + + + + + + + + + + + + Cortana + + + + + + + + + + + + + + + + + + Bender + + + + + + + + + + + + + + + + + + BB-8 + + + + + + + + + + + + + + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/item/content-types/actions/vue.md b/static/usage/v7/item/content-types/actions/vue.md new file mode 100644 index 00000000000..bef520f8f19 --- /dev/null +++ b/static/usage/v7/item/content-types/actions/vue.md @@ -0,0 +1,191 @@ +```html + + + +``` diff --git a/static/usage/v7/item/content-types/controls/angular.md b/static/usage/v7/item/content-types/controls/angular.md new file mode 100644 index 00000000000..2275f6468cd --- /dev/null +++ b/static/usage/v7/item/content-types/controls/angular.md @@ -0,0 +1,39 @@ +```html + + + Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/static/usage/v7/item/content-types/controls/demo.html b/static/usage/v7/item/content-types/controls/demo.html new file mode 100644 index 00000000000..474097b1616 --- /dev/null +++ b/static/usage/v7/item/content-types/controls/demo.html @@ -0,0 +1,54 @@ + + + + + + Item + + + + + + + + + + + Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/usage/v7/item/content-types/controls/index.md b/static/usage/v7/item/content-types/controls/index.md new file mode 100644 index 00000000000..8c878934a01 --- /dev/null +++ b/static/usage/v7/item/content-types/controls/index.md @@ -0,0 +1,19 @@ +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/item/content-types/controls/javascript.md b/static/usage/v7/item/content-types/controls/javascript.md new file mode 100644 index 00000000000..421c9ff6924 --- /dev/null +++ b/static/usage/v7/item/content-types/controls/javascript.md @@ -0,0 +1,39 @@ +```html + + + Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/static/usage/v7/item/content-types/controls/react.md b/static/usage/v7/item/content-types/controls/react.md new file mode 100644 index 00000000000..fef330390b1 --- /dev/null +++ b/static/usage/v7/item/content-types/controls/react.md @@ -0,0 +1,49 @@ +```tsx +import React from 'react'; +import { IonCheckbox, IonContent, IonHeader, IonInput, IonItem, IonList, IonTitle, IonToolbar } from '@ionic/react'; + +function Example() { + return ( + <> + + + Example + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/item/content-types/controls/vue.md b/static/usage/v7/item/content-types/controls/vue.md new file mode 100644 index 00000000000..4c5e5b8bf76 --- /dev/null +++ b/static/usage/v7/item/content-types/controls/vue.md @@ -0,0 +1,59 @@ +```html + + + +``` diff --git a/static/usage/v7/item/content-types/metadata/angular/example_component_css.md b/static/usage/v7/item/content-types/metadata/angular/example_component_css.md new file mode 100644 index 00000000000..44f7e0d5e43 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/angular/example_component_css.md @@ -0,0 +1,41 @@ +```css +.unread-indicator { + background: var(--ion-color-primary); + + width: 10px; + height: 10px; + + border-radius: 100%; + + position: absolute; + + inset-inline-start: 12px; + top: 12px; +} + +.metadata-end-wrapper { + position: absolute; + + top: 10px; + inset-inline-end: 10px; + + font-size: 0.8rem; + + display: flex; + align-items: center; +} + +ion-label strong { + display: block; + + max-width: calc(100% - 60px); + + overflow: hidden; + + text-overflow: ellipsis; +} + +ion-label ion-note { + font-size: 0.9rem; +} +``` diff --git a/static/usage/v7/item/content-types/metadata/angular/example_component_html.md b/static/usage/v7/item/content-types/metadata/angular/example_component_html.md new file mode 100644 index 00000000000..bb97bb4a70a --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/angular/example_component_html.md @@ -0,0 +1,90 @@ +```html + + + Example + + + + + + + General + 6 + + + + Shopping + 15 + + + + Cleaning + 3 + + + + Reminders + 8 + + + + + +
+
+
+ + Rick Astley + Never Gonna Give You Up
+ + Never gonna give you up Never gonna let you down Never gonna run... + +
+ +
+ +
+ + Ionitron + I have become sentient
+ That is all. +
+ +
+ +
+
+
+ + Steam + Game Store Sale
+ + That game you added to your wish list 2 years ago is now on sale! + +
+ +
+ +
+ + Ionic + Announcing Ionic 7.0
+ This version is one more than Ionic 6! +
+ +
+
+
+``` diff --git a/static/usage/v7/item/content-types/metadata/demo.html b/static/usage/v7/item/content-types/metadata/demo.html new file mode 100644 index 00000000000..c154fc145a1 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/demo.html @@ -0,0 +1,146 @@ + + + + + + Item + + + + + + + + + + + + Example + + + + + + + General + 6 + + + + Shopping + 15 + + + + Cleaning + 3 + + + + Reminders + 8 + + + + + +
+
+
+ + Rick Astley + Never Gonna Give You Up
+ + Never gonna give you up Never gonna let you down Never gonna run... + +
+ +
+ +
+ + Ionitron + I have become sentient
+ That is all. +
+ +
+ +
+
+
+ + Steam + Game Store Sale
+ + That game you added to your wish list 2 years ago is now on sale! + +
+ +
+ +
+ + Ionic + Announcing Ionic 7.0
+ This version is one more than Ionic 6! +
+ +
+
+
+
+ + diff --git a/static/usage/v7/item/content-types/metadata/index.md b/static/usage/v7/item/content-types/metadata/index.md new file mode 100644 index 00000000000..07309acea21 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/index.md @@ -0,0 +1,34 @@ +import Playground from '@site/src/components/global/Playground'; + +import javascript from './javascript.md'; + +import react_main_tsx from './react/main_tsx.md'; +import react_main_css from './react/main_css.md'; + +import vue from './vue.md'; + +import angular_example_component_html from './angular/example_component_html.md'; +import angular_example_component_css from './angular/example_component_css.md'; + + diff --git a/static/usage/v7/item/content-types/metadata/javascript.md b/static/usage/v7/item/content-types/metadata/javascript.md new file mode 100644 index 00000000000..60e16a46273 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/javascript.md @@ -0,0 +1,132 @@ +```html + + + Example + + + + + + + General + 6 + + + + Shopping + 15 + + + + Cleaning + 3 + + + + Reminders + 8 + + + + + +
+
+
+ + Rick Astley + Never Gonna Give You Up
+ + Never gonna give you up Never gonna let you down Never gonna run... + +
+ +
+ +
+ + Ionitron + I have become sentient
+ That is all. +
+ +
+ +
+
+
+ + Steam + Game Store Sale
+ + That game you added to your wish list 2 years ago is now on sale! + +
+ +
+ +
+ + Ionic + Announcing Ionic 7.0
+ This version is one more than Ionic 6! +
+ +
+
+
+ + +``` diff --git a/static/usage/v7/item/content-types/metadata/react/main_css.md b/static/usage/v7/item/content-types/metadata/react/main_css.md new file mode 100644 index 00000000000..44f7e0d5e43 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/react/main_css.md @@ -0,0 +1,41 @@ +```css +.unread-indicator { + background: var(--ion-color-primary); + + width: 10px; + height: 10px; + + border-radius: 100%; + + position: absolute; + + inset-inline-start: 12px; + top: 12px; +} + +.metadata-end-wrapper { + position: absolute; + + top: 10px; + inset-inline-end: 10px; + + font-size: 0.8rem; + + display: flex; + align-items: center; +} + +ion-label strong { + display: block; + + max-width: calc(100% - 60px); + + overflow: hidden; + + text-overflow: ellipsis; +} + +ion-label ion-note { + font-size: 0.9rem; +} +``` diff --git a/static/usage/v7/item/content-types/metadata/react/main_tsx.md b/static/usage/v7/item/content-types/metadata/react/main_tsx.md new file mode 100644 index 00000000000..e15dfc2d314 --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/react/main_tsx.md @@ -0,0 +1,122 @@ +```tsx +import React from 'react'; +import { + IonContent, + IonHeader, + IonIcon, + IonItem, + IonLabel, + IonList, + IonNote, + IonText, + IonTitle, + IonToolbar, +} from '@ionic/react'; +import { chevronForward, listCircle } from 'ionicons/icons'; + +import './main.css'; + +function Example() { + return ( + <> + + + Example + + + + + + + General + 6 + + + + Shopping + 15 + + + + Cleaning + 3 + + + + Reminders + 8 + + + + + +
+
+
+ + Rick Astley + Never Gonna Give You Up +
+ + Never gonna give you up Never gonna let you down Never gonna run... + +
+
+ 06:11 + +
+
+ +
+ + Ionitron + I have become sentient +
+ + That is all. + +
+
+ 03:44 + +
+
+ +
+
+
+ + Steam + Game Store Sale +
+ + That game you added to your wish list 2 years ago is now on sale! + +
+
+ Yesterday + +
+
+ +
+ + Ionic + Announcing Ionic 7.0 +
+ + This version is one more than Ionic 6! + +
+
+ Yesterday + +
+
+
+
+ + ); +} +export default Example; +``` diff --git a/static/usage/v7/item/content-types/metadata/vue.md b/static/usage/v7/item/content-types/metadata/vue.md new file mode 100644 index 00000000000..5183d079aef --- /dev/null +++ b/static/usage/v7/item/content-types/metadata/vue.md @@ -0,0 +1,169 @@ +```html + + + + + +``` diff --git a/static/usage/v7/item/content-types/supporting-visuals/angular.md b/static/usage/v7/item/content-types/supporting-visuals/angular.md new file mode 100644 index 00000000000..e4ae4368ea2 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/angular.md @@ -0,0 +1,47 @@ +```html + + + + Airplane Mode + + + + Wi-Fi + + + + Bluetooth + + + + Cellular + + + + + + + Huey + + + + Dewey + + + + Louie + + + + Fooie + + +``` diff --git a/static/usage/v7/item/content-types/supporting-visuals/demo.html b/static/usage/v7/item/content-types/supporting-visuals/demo.html new file mode 100644 index 00000000000..6d97b2a4621 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/demo.html @@ -0,0 +1,66 @@ + + + + + + Item + + + + + + + + + +
+ + + + Airplane Mode + + + + Wi-Fi + + + + Bluetooth + + + + Cellular + + + + + + + Huey + + + + Dewey + + + + Louie + + + + Fooie + + +
+
+
+ + diff --git a/static/usage/v7/item/content-types/supporting-visuals/index.md b/static/usage/v7/item/content-types/supporting-visuals/index.md new file mode 100644 index 00000000000..b9138937221 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/index.md @@ -0,0 +1,18 @@ +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/item/content-types/supporting-visuals/javascript.md b/static/usage/v7/item/content-types/supporting-visuals/javascript.md new file mode 100644 index 00000000000..e4ae4368ea2 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/javascript.md @@ -0,0 +1,47 @@ +```html + + + + Airplane Mode + + + + Wi-Fi + + + + Bluetooth + + + + Cellular + + + + + + + Huey + + + + Dewey + + + + Louie + + + + Fooie + + +``` diff --git a/static/usage/v7/item/content-types/supporting-visuals/react.md b/static/usage/v7/item/content-types/supporting-visuals/react.md new file mode 100644 index 00000000000..d9f6a53c916 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/react.md @@ -0,0 +1,58 @@ +```tsx +import React from 'react'; +import { IonAvatar, IonItem, IonLabel, IonList, IonIcon } from '@ionic/react'; +import { airplane, bluetooth, call, wifi } from 'ionicons/icons'; + +function Example() { + return ( + <> + + + + Airplane Mode + + + + Wi-Fi + + + + Bluetooth + + + + Cellular + + + + + + + Huey + + + + Dewey + + + + Louie + + + + Fooie + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/item/content-types/supporting-visuals/vue.md b/static/usage/v7/item/content-types/supporting-visuals/vue.md new file mode 100644 index 00000000000..73f3eb56721 --- /dev/null +++ b/static/usage/v7/item/content-types/supporting-visuals/vue.md @@ -0,0 +1,68 @@ +```html + + + +``` diff --git a/static/usage/v7/item/content-types/text/angular/example_component_css.md b/static/usage/v7/item/content-types/text/angular/example_component_css.md new file mode 100644 index 00000000000..65190f24e16 --- /dev/null +++ b/static/usage/v7/item/content-types/text/angular/example_component_css.md @@ -0,0 +1,5 @@ +```css +ion-note { + display: block; +} +``` diff --git a/static/usage/v7/item/content-types/text/angular/example_component_html.md b/static/usage/v7/item/content-types/text/angular/example_component_html.md new file mode 100644 index 00000000000..7cf6fac8392 --- /dev/null +++ b/static/usage/v7/item/content-types/text/angular/example_component_html.md @@ -0,0 +1,33 @@ +```html + + + Example + + + + + + + + + + + + + Allow Notifications + Unsubscribe at any time + + + + + + + + + + + + Your comments will be kept anonymous and will only be used to improve the reliability of our products. + +``` diff --git a/static/usage/v7/item/content-types/text/demo.html b/static/usage/v7/item/content-types/text/demo.html new file mode 100644 index 00000000000..13b557a456e --- /dev/null +++ b/static/usage/v7/item/content-types/text/demo.html @@ -0,0 +1,53 @@ + + + + + + Item + + + + + + + + + + + + Example + + + + + + + + + + + + + Allow Notifications + Unsubscribe at any time + + + + + + + + + + + + Your comments will be kept anonymous and will only be used to improve the reliability of our products. + + + + + diff --git a/static/usage/v7/item/content-types/text/index.md b/static/usage/v7/item/content-types/text/index.md new file mode 100644 index 00000000000..fad22f71dd4 --- /dev/null +++ b/static/usage/v7/item/content-types/text/index.md @@ -0,0 +1,34 @@ +import Playground from '@site/src/components/global/Playground'; + +import javascript from './javascript.md'; + +import react_main_tsx from './react/main_tsx.md'; +import react_main_css from './react/main_css.md'; + +import vue from './vue.md'; + +import angular_example_component_html from './angular/example_component_html.md'; +import angular_example_component_css from './angular/example_component_css.md'; + + diff --git a/static/usage/v7/item/content-types/text/javascript.md b/static/usage/v7/item/content-types/text/javascript.md new file mode 100644 index 00000000000..951d0474733 --- /dev/null +++ b/static/usage/v7/item/content-types/text/javascript.md @@ -0,0 +1,39 @@ +```html + + + Example + + + + + + + + + + + + + Allow Notifications + Unsubscribe at any time + + + + + + + + + + + + Your comments will be kept anonymous and will only be used to improve the reliability of our products. + + + + +``` diff --git a/static/usage/v7/item/content-types/text/react/main_css.md b/static/usage/v7/item/content-types/text/react/main_css.md new file mode 100644 index 00000000000..65190f24e16 --- /dev/null +++ b/static/usage/v7/item/content-types/text/react/main_css.md @@ -0,0 +1,5 @@ +```css +ion-note { + display: block; +} +``` diff --git a/static/usage/v7/item/content-types/text/react/main_tsx.md b/static/usage/v7/item/content-types/text/react/main_tsx.md new file mode 100644 index 00000000000..107dbe79540 --- /dev/null +++ b/static/usage/v7/item/content-types/text/react/main_tsx.md @@ -0,0 +1,57 @@ +```tsx +import React from 'react'; +import { + IonContent, + IonHeader, + IonInput, + IonItem, + IonLabel, + IonList, + IonNote, + IonTextarea, + IonToggle, + IonToolbar, + IonTitle, +} from '@ionic/react'; + +import './main.css'; + +function Example() { + return ( + <> + + + Example + + + + + + + + + + + + + Allow Notifications + Unsubscribe at any time + + + + + + + + + + + + Your comments will be kept anonymous and will only be used to improve the reliability of our products. + + + + ); +} +export default Example; +``` diff --git a/static/usage/v7/item/content-types/text/vue.md b/static/usage/v7/item/content-types/text/vue.md new file mode 100644 index 00000000000..f6b36a8f6d8 --- /dev/null +++ b/static/usage/v7/item/content-types/text/vue.md @@ -0,0 +1,74 @@ +```html + + + + + +``` diff --git a/static/usage/v7/item/inputs/angular.md b/static/usage/v7/item/inputs/angular.md index a45e76ebc73..548e6239f98 100644 --- a/static/usage/v7/item/inputs/angular.md +++ b/static/usage/v7/item/inputs/angular.md @@ -15,14 +15,6 @@ - - - - - - - - No Game Console diff --git a/static/usage/v7/item/inputs/demo.html b/static/usage/v7/item/inputs/demo.html index b4021dbc714..4a277efb875 100644 --- a/static/usage/v7/item/inputs/demo.html +++ b/static/usage/v7/item/inputs/demo.html @@ -36,22 +36,6 @@ - - - - - - - - No Game Console diff --git a/static/usage/v7/item/inputs/javascript.md b/static/usage/v7/item/inputs/javascript.md index 74558c5191a..53c2e4cb6e8 100644 --- a/static/usage/v7/item/inputs/javascript.md +++ b/static/usage/v7/item/inputs/javascript.md @@ -15,14 +15,6 @@ - - - - - - - - No Game Console diff --git a/static/usage/v7/item/inputs/react.md b/static/usage/v7/item/inputs/react.md index 6f3cf757c68..b7f41601048 100644 --- a/static/usage/v7/item/inputs/react.md +++ b/static/usage/v7/item/inputs/react.md @@ -21,22 +21,6 @@ function Example() { - - - - - - - - No Game Console diff --git a/static/usage/v7/item/inputs/vue.md b/static/usage/v7/item/inputs/vue.md index 6ce71990b7e..62ce6f5efc1 100644 --- a/static/usage/v7/item/inputs/vue.md +++ b/static/usage/v7/item/inputs/vue.md @@ -16,18 +16,6 @@ - - - - - - - - No Game Console