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 ItemsAn 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 by default in ios
mode.
#
Detail ArrowsBy default 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 PlacementItem uses named slots 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 AlignmentItems left align text and add an ellipsis when the text is wider than the item. See the CSS Utilities Documentation for classes that can be added to <ion-item>
to transform the text.
#
Input Highlight#
Highlight HeightItems 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.
#
Highlight ColorThe 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 section below for the highlight color variables.
#
Usage- ANGULAR
- JAVASCRIPT
- REACT
- STENCIL
- VUE
#
Properties#
buttonDescription | If true , a button tag will be rendered and the item will be tappable. |
Attribute | button |
Type | boolean |
Default | false |
#
colorDescription | 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. |
Attribute | color |
Type | string \| undefined |
Default | undefined |
#
counterDescription | 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 . |
Attribute | counter |
Type | boolean |
Default | true |
#
detailDescription | 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. |
Attribute | detail |
Type | boolean \| undefined |
Default | undefined |
#
detailIconDescription | The icon to use when detail is set to true . |
Attribute | detail-icon |
Type | string |
Default | 'chevron-forward' |
#
disabledDescription | If true , the user cannot interact with the item. |
Attribute | disabled |
Type | boolean |
Default | false |
#
downloadDescription | 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). |
Attribute | download |
Type | string \| undefined |
Default | undefined |
#
fillDescription | 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. |
Attribute | fill |
Type | "outline" \| "solid" \| undefined |
Default | undefined |
#
hrefDescription | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. |
Attribute | href |
Type | string \| undefined |
Default | undefined |
#
linesDescription | How the bottom border should be displayed on the item. |
Attribute | lines |
Type | "full" \| "inset" \| "none" \| undefined |
Default | undefined |
#
modeDescription | The mode determines which platform styles to use. |
Attribute | mode |
Type | "ios" \| "md" |
Default | undefined |
#
relDescription | Specifies the relationship of the target object to the link object. The value is a space-separated list of link types. |
Attribute | rel |
Type | string \| undefined |
Default | undefined |
#
routerAnimationDescription | When using a router, it specifies the transition animation when navigating to another page using href . |
Attribute | undefined |
Type | ((baseEl: any, opts?: any) => Animation) \| undefined |
Default | undefined |
#
routerDirectionDescription | When using a router, it specifies the transition direction when navigating to another page using href . |
Attribute | router-direction |
Type | "back" \| "forward" \| "root" |
Default | 'forward' |
#
shapeDescription | The shape of the item. If "round" it will have increased border radius. |
Attribute | shape |
Type | "round" \| undefined |
Default | undefined |
#
targetDescription | Specifies where to display the linked URL. Only applies when an href is provided.Special keywords: "_blank" , "_self" , "_parent" , "_top" . |
Attribute | target |
Type | string \| undefined |
Default | undefined |
#
typeDescription | The type of the button. Only used when an onclick or button property is present. |
Attribute | type |
Type | "button" \| "reset" \| "submit" |
Default | 'button' |
#
CSS Shadow PartsName | 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 PropertiesName | 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 |
#
SlotsName | 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. |
start | Content is placed to the left of the item text in LTR, and to the right in RTL. |