# ion-item 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 with other items. Items can be swiped, deleted, reordered, edited, and more. ## 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. ## Detail Arrows By default [clickable items](#clickable-items) will display a right arrow icon on `ios` mode. To hide the right arrow icon on clickable elements, set the `detail` property to `false`. To show the right arrow icon on an item that doesn't display it naturally, set the `detail` property to `true`. ## Item Placement Item uses named [slots](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) in order to position content. 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 item slots and where it will place the element inside of the item: | Slot | Description | |---------|-----------------------------------------------------------------------------| | `start` | Placed to the left of all other content in LTR, and to the `right` in RTL. | | `end` | Placed to the right of all other content in LTR, and to the `left` in RTL. | | none | Placed inside of the input wrapper. | ### Text Alignment Items left align text and add an ellipsis when the text is wider than the item. See the [CSS Utilities Documentation](/docs/layout/css-utilities) for classes that can be added to `` to transform the text. ## Input Highlight ### Highlight Height Items containing an input will highlight the bottom border of the input with a different color when focused, valid, or invalid. By default, `md` items have a highlight with a height set to `2px` and `ios` has no highlight (technically the height is set to `0`). The height can be changed using the `--highlight-height` CSS property. To turn off the highlight, set this variable to `0`. For more information on setting CSS properties, see the [theming documentation](/docs/theming/css-variables). ### Highlight Color The highlight color changes based on the item state, but all of the states use Ionic colors by default. When focused, the input highlight will use the `primary` color. If the input is valid it will use the `success` color, and invalid inputs will use the `danger` color. See the [CSS Custom Properties](#css-custom-properties) section below for the highlight color variables. ## Usage ### Angular ```html Item Button Item Anchor Item Secondary Color Item ``` ### Detail Arrows ```html Standard Item with Detail Arrow Button Item with Detail Arrow Anchor Item with no Detail Arrow ``` ### List Items ```html Item No Lines Item Multiline text that should wrap when it is too long to fit on one line in the item.

H3 Primary Title

Paragraph line 1

Paragraph line 2 secondary

Item with Full Lines
``` ### Item Lines ```html Item Lines Inset Item Lines Full Item Lines None Full Lines Item 1 Full Lines Item 2 Inset Lines Item 1 Inset Lines Item 2 No lines Item 1 No lines Item 2 No lines Item 3 ``` ### Media Items ```html Avatar Start, Button Item Thumbnail End, Anchor Item

H2 Title Text

Button on right

View

H3 Title Text

Icon on right

``` ### Buttons in Items ```html Start Button Start/End End Start Icon Buttons with Icons End Icon Icon only Buttons ``` ### Icons in Items ```html Icon End Large Icon End Small Icon End Icon Start Two Icons End ``` ### Item Inputs ```html Datetime Select No Game Console NES Nintendo64 PlayStation Sega Genesis Sega Saturn SNES Toggle Floating Input Input (placeholder) Input (Fill: Solid) Input (Fill: Outline) Helper and Error Text Helper Text Error Text Checkbox Range ``` ### Javascript ```html Item Button Item Anchor Item Secondary Color Item ``` ### Detail Arrows ```html Standard Item with Detail Arrow Button Item with Detail Arrow Anchor Item with no Detail Arrow ``` ### List Items ```html Item No Lines Item Multiline text that should wrap when it is too long to fit on one line in the item.

H3 Primary Title

Paragraph line 1

Paragraph line 2 secondary

Item with Full Lines
``` ### Item Lines ```html Item Lines Inset Item Lines Full Item Lines None Full Lines Item 1 Full Lines Item 2 Inset Lines Item 1 Inset Lines Item 2 No lines Item 1 No lines Item 2 No lines Item 3 ``` ### Media Items ```html Avatar Start, Button Item Thumbnail End, Anchor Item

H2 Title Text

Button on right

View

H3 Title Text

Icon on right

``` ### Buttons in Items ```html Start Button Start/End End Start Icon Buttons with Icons End Icon Icon only Buttons ``` ### Icons in Items ```html Icon End Large Icon End Small Icon End Icon Start Two Icons End ``` ### Item Inputs ```html Datetime Select No Game Console NES Nintendo64 PlayStation Sega Genesis Sega Saturn SNES Toggle Floating Input Input (placeholder) Input (Fill: Solid) Input (Fill: Outline) Helper and Error Text Helper Text Error Text Checkbox Range ``` ### React ```tsx import React from 'react'; import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonItem, IonLabel, IonList, IonText, IonAvatar, IonThumbnail, IonButton, IonIcon, IonDatetime, IonSelect, IonSelectOption, IonToggle, IonInput, IonCheckbox, IonRange, IonNote } from '@ionic/react'; import { closeCircle, home, star, navigate, informationCircle, checkmarkCircle, shuffle } from 'ionicons/icons'; export const ItemExamples: React.FC = () => { return ( ItemExamples {/*-- Default Item --*/} Item {/*-- Item as a Button --*/} { }}> Button Item {/*-- Item as an Anchor --*/} Anchor Item Secondary Color Item {/*-- Detail Arrows --*/} Standard Item with Detail Arrow { }} detail> Button Item with Detail Arrow Anchor Item with no Detail Arrow Item No Lines Item Multiline text that should wrap when it is too long to fit on one line in the item.

H3 Primary Title

Paragraph line 1

Paragraph line 2 secondary

Item with Full Lines
{/*-- Item Inset Lines --*/} Item Lines Inset {/*-- Item Full Lines --*/} Item Lines Full {/*-- Item None Lines --*/} Item Lines None {/*-- List Full Lines --*/} Full Lines Item 1 Full Lines Item 2 {/*-- List Inset Lines --*/} Inset Lines Item 1 Inset Lines Item 2 {/*-- List No Lines --*/} No lines Item 1 No lines Item 2 No lines Item 3 { }}> Avatar Start, Button Item Thumbnail End, Anchor Item

H2 Title Text

Button on right

View
{ }}>

H3 Title Text

Icon on right

{/*-- Buttons in Items --*/} Start Button Start/End End Start Icon Buttons with Icons End Icon Icon only Buttons Icon End Large Icon End Small Icon End Icon Start Two Icons End Datetime Select No Game Console NES Nintendo64 PlayStation Sega Genesis Sega Saturn SNES Toggle Floating Input Input (placeholder) Input (Fill: Solid) Input (Fill: Outline) Helper and Error Text Helper Text Error Text Checkbox Range
); }; ``` ### Stencil ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { buttonClick() { console.log('Clicked button'); } render() { return [ // Default Item Item , // Item as a Button this.buttonClick()}> Button Item , // Item as an Anchor Anchor Item , Secondary Color Item ]; } } ``` ### Detail Arrows ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { buttonClick() { console.log('Clicked button'); } render() { return [ Standard Item with Detail Arrow , this.buttonClick()} detail> Button Item with Detail Arrow , Anchor Item with no Detail Arrow ]; } } ``` ### List Items ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { render() { return [ Item , No Lines Item , Multiline text that should wrap when it is too long to fit on one line in the item. ,

H3 Primary Title

Paragraph line 1

Paragraph line 2 secondary

, Item with Full Lines
]; } } ``` ### Item Lines ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { render() { return [ // Item Inset Lines Item Lines Inset , // Item Full Lines Item Lines Full , // Item None Lines Item Lines None , // List Full Lines Full Lines Item 1 Full Lines Item 2 , // List Inset Lines Inset Lines Item 1 Inset Lines Item 2 , // List No Lines No lines Item 1 No lines Item 2 No lines Item 3 ]; } } ``` ### Media Items ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { testClick() { console.log('Test click'); } render() { return [ this.testClick()}> Avatar Start, Button Item , Thumbnail End, Anchor Item ,

H2 Title Text

Button on right

View
, this.testClick()}>

H3 Title Text

Icon on right

]; } } ``` ### Buttons in Items ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { render() { return [ Start Button Start/End End , Start Icon Buttons with Icons End Icon , Icon only Buttons ]; } } ``` ### Icons in Items ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { render() { return [ Icon End , Large Icon End , Small Icon End , Icon Start , Two Icons End ]; } } ``` ### Item Inputs ```tsx import { Component, h } from '@stencil/core'; @Component({ tag: 'item-example', styleUrl: 'item-example.css' }) export class ItemExample { render() { return [ Datetime , Select No Game Console NES Nintendo64 PlayStation Sega Genesis Sega Saturn SNES , Toggle , Floating Input , Input (placeholder) , Input (Fill: Solid) , Input (Fill: Outline) , Helper and Error Text Helper Text Error Text , Checkbox , Range ]; } } ``` ### Vue ```html ``` ### Detail Arrows ```html ``` ### List Items ```html ``` ### Item Lines ```html ``` ### Media Items ```html ``` ### Buttons in Items ```html ``` ### Icons in Items ```html ``` ### Item Inputs ```html ``` ## Properties | Property | Attribute | Description | Type | Default | | ----------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ---------------- | | `button` | `button` | If `true`, a button tag will be rendered and the item will be tappable. | `boolean` | `false` | | `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `string \| undefined` | `undefined` | | `counter` | `counter` | If `true`, a character counter will display the ratio of characters used and the total character limit. Only applies when the `maxlength` property is set on the inner `ion-input` or `ion-textarea`. | `boolean` | `false` | | `detail` | `detail` | If `true`, a detail arrow will appear on the item. Defaults to `false` unless the `mode` is `ios` and an `href` or `button` property is present. | `boolean \| undefined` | `undefined` | | `detailIcon` | `detail-icon` | The icon to use when `detail` is set to `true`. | `string` | `chevronForward` | | `disabled` | `disabled` | If `true`, the user cannot interact with the item. | `boolean` | `false` | | `download` | `download` | This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want). | `string \| undefined` | `undefined` | | `fill` | `fill` | The fill for the item. If `'solid'` the item will have a background. If `'outline'` the item will be transparent with a border. Only available in `md` mode. | `"outline" \| "solid" \| undefined` | `undefined` | | `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string \| undefined` | `undefined` | | `lines` | `lines` | How the bottom border should be displayed on the item. | `"full" \| "inset" \| "none" \| undefined` | `undefined` | | `mode` | `mode` | The mode determines which platform styles to use. | `"ios" \| "md"` | `undefined` | | `rel` | `rel` | Specifies the relationship of the target object to the link object. The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types). | `string \| undefined` | `undefined` | | `routerAnimation` | -- | When using a router, it specifies the transition animation when navigating to another page using `href`. | `((baseEl: any, opts?: any) => Animation) \| undefined` | `undefined` | | `routerDirection` | `router-direction` | When using a router, it specifies the transition direction when navigating to another page using `href`. | `"back" \| "forward" \| "root"` | `'forward'` | | `shape` | `shape` | The shape of the item. If "round" it will have increased border radius. | `"round" \| undefined` | `undefined` | | `target` | `target` | Specifies where to display the linked URL. Only applies when an `href` is provided. Special keywords: `"_blank"`, `"_self"`, `"_parent"`, `"_top"`. | `string \| undefined` | `undefined` | | `type` | `type` | The type of the button. Only used when an `onclick` or `button` property is present. | `"button" \| "reset" \| "submit"` | `'button'` | ## Slots | Slot | Description | | ---------- | ------------------------------------------------------------------------------- | | | Content is placed between the named slots if provided without a slot. | | `"end"` | Content is placed to the right of the item text in LTR, and to the left in RTL. | | `"error"` | Content is placed under the item and displayed when an error is detected. | | `"helper"` | Content is placed under the item and displayed when no error is detected. | | `"start"` | Content is placed to the left of the item text in LTR, and to the right in RTL. | ## Shadow Parts | Part | Description | | --------------- | ---------------------------------------------------------------------------- | | `"detail-icon"` | The chevron icon for the item. Only applies when `detail="true"`. | | `"native"` | The native HTML button, anchor or div element that wraps all child elements. | ## CSS Custom Properties | Name | Description | | -------------------------------- | ------------------------------------------------------------------------------------------------------------- | | `--background` | Background of the item | | `--background-activated` | Background of the item when pressed. Note: setting this will interfere with the Material Design ripple. | | `--background-activated-opacity` | Opacity of the item background when pressed | | `--background-focused` | Background of the item when focused with the tab key | | `--background-focused-opacity` | Opacity of the item background when focused with the tab key | | `--background-hover` | Background of the item on hover | | `--background-hover-opacity` | Opacity of the background of the item on hover | | `--border-color` | Color of the item border | | `--border-radius` | Radius of the item border | | `--border-style` | Style of the item border | | `--border-width` | Width of the item border | | `--color` | Color of the item | | `--color-activated` | Color of the item when pressed | | `--color-focused` | Color of the item when focused with the tab key | | `--color-hover` | Color of the item on hover | | `--detail-icon-color` | Color of the item detail icon | | `--detail-icon-font-size` | Font size of the item detail icon | | `--detail-icon-opacity` | Opacity of the item detail icon | | `--highlight-color-focused` | The color of the highlight on the item when focused | | `--highlight-color-invalid` | The color of the highlight on the item when invalid | | `--highlight-color-valid` | The color of the highlight on the item when valid | | `--highlight-height` | The height of the highlight on the item | | `--inner-border-width` | Width of the item inner border | | `--inner-box-shadow` | Box shadow of the item inner | | `--inner-padding-bottom` | Bottom padding of the item inner | | `--inner-padding-end` | Right padding if direction is left-to-right, and left padding if direction is right-to-left of the item inner | | `--inner-padding-start` | Left padding if direction is left-to-right, and right padding if direction is right-to-left of the item inner | | `--inner-padding-top` | Top padding of the item inner | | `--min-height` | Minimum height of the item | | `--padding-bottom` | Bottom padding of the item | | `--padding-end` | Right padding if direction is left-to-right, and left padding if direction is right-to-left of the item | | `--padding-start` | Left padding if direction is left-to-right, and right padding if direction is right-to-left of the item | | `--padding-top` | Top padding of the item | | `--ripple-color` | Color of the item ripple effect | | `--transition` | Transition of the item | ## Dependencies ### Used by - [ion-datetime](../datetime) - ion-select-popover ### Depends on - ion-icon - [ion-ripple-effect](../ripple-effect) - [ion-note](../note) ### Graph ```mermaid graph TD; ion-item --> ion-icon ion-item --> ion-ripple-effect ion-item --> ion-note ion-datetime --> ion-item ion-select-popover --> ion-item style ion-item fill:#f9f,stroke:#333,stroke-width:4px ``` ---------------------------------------------- *Built with [StencilJS](https://stenciljs.com/)*