diff --git a/src/components/item/item.ts b/src/components/item/item.ts index 254d66abbc5..e56416d1940 100644 --- a/src/components/item/item.ts +++ b/src/components/item/item.ts @@ -9,34 +9,218 @@ import {Label} from '../label/label'; /** * @name Item * @description - * Creates a list-item that can easily be swiped, deleted, reordered, edited, and more. + * An item can contain text, images, and anything else. Generally it is placed in a list with other + * items. It can easily be swiped, deleted, reordered, edited, and more. An item is only required to + * be in a [List](../../list/List) if manipulating the item via gestures is required. It requires an + * [ItemSliding](../ItemSliding) wrapper element in order to be swiped. * - * There are three common ways to use an item: - * - Use `` for something that is only non-clickable text. - * - Use ` + * + * + * Anchor Item + * + * ``` + * + * ## Detail Arrows + * By default, ` + * + * + * Anchor Item with no Detail Arrow + * + * ``` + * + * This feature is not enabled by default for `md` and `wp` modes, but it can be enabled by setting the + * Sass variables `$item-md-detail-push-show` and `$item-wp-detail-push-show`, respectively, to `true`. + * It can also be disabled for ios by setting `$item-ios-detail-push-show` to `false`. See the + * [theming documentation](http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/) for + * more information on overriding Sass variables. + * + * + * ## Item Placement + * Items rely heavily on content projection to position content. The item grabs content based on the + * element or attribute and positions it that way. This logic makes it possible to write a complex + * item with simple, understandable markup without having to worry about styling and positioning + * the elements. + * + * The below chart details the attributes item looks for and where it will place the element with + * that attribute inside of the item: + * + * | Attribute | Description | + * |----------------|----------------------------------------------------------------------------------------------------- | + * | `item-left` | Placed to the left of all other elements, outside of the inner item. | + * | `item-right` | Placed to the right of all other elements, inside of the inner item, outside of the input wrapper. | + * | `item-content` | Placed to the right of any `ion-label`, inside of the input wrapper. | + * + * ### Checkboxes, Radios and Toggles + * [Checkboxes](../../checkbox/Checkbox) are positioned in the same place as the `item-left` attribute. + * [Radios](../../radio/RadioButton) and [Toggles](../../toggle/Toggle) are positioned in the same place + * as the `item-right` attribute. All of these components can be positioned differently by adding the + * `item-left` or `item-right` attribute. + * + * ### Content and Inputs + * A [Label](../../label/Label) is placed inside of the item to the left of all content and inputs. The + * following components are all placed in the same position as the `item-content` attribute: [Select](../../select/Select), + * [Input](../../input/Input), [TextArea](../../input/TextArea), [DateTime](../../datetime/DateTime), and + * [Range](../../range/Range). + * + * Any element directly placed inside of an `` that does not have one of the previously mentioned + * attributes and isn't one of the above elements will be placed inside of a [Label](../../label/Label). * * * @usage + * * ```html + * + * + * + * Item + * + * + * + * Item with Detail Arrow + * * + * + * + * + * + * + * Anchor Item + * + * + * + * Item with no border + * + * + * + * Multiline text that should wrap when it is too long + * to fit on one line in the item. + * + * + * + * ``` + * + * + * @advanced + * + * ```html * * - * // default item + * + * + * Item {% raw %}{{item}}{% endraw %} + * + * + * + * + * + * + * + * + * Item Label + * + *
+ * Item Content next to the label + *
+ *
+ * + * * - * {% raw %}{{item.title}}{% endraw %} + * + * Item + * * * + * + * + * Disabled Button Item + * + * + * + * + * + * + * + * + * Avatar Item + * + * + * + * + * + *

Item

+ *

Item Paragraph

+ * + * + * + *
+ * + * + * + * + * Item + * + * + * + * + * + * *
+ * ``` + * * - * ``` * @demo /docs/v2/demos/item/ * @see {@link /docs/v2/components#lists List Component Docs} * @see {@link ../../list/List List API Docs} + * @see {@link ../ItemSliding ItemSliding API Docs} */ @Component({ selector: 'ion-item,[ion-item]',