ion-list-header
List headers are block elements that are used to describe the contents of a list. Unlike item dividers, list headers should only be used once at the top of a list of items.
Basic Usage
<ion-list>
<ion-list-header>
<ion-label>Video Games</ion-label>
</ion-list-header>
<ion-item>
<ion-label>PokΓ©mon Yellow</ion-label>
</ion-item>
<ion-item>
<ion-label>Mega Man X</ion-label>
</ion-item>
<ion-item>
<ion-label>The Legend of Zelda</ion-label>
</ion-item>
<ion-item>
<ion-label>Pac-Man</ion-label>
</ion-item>
<ion-item>
<ion-label>Super Mario World</ion-label>
</ion-item>
</ion-list>
Buttons in List Headers
A button placed in a list header can be useful for showing part of a list and redirecting to the full list with the button.
<ion-list>
<ion-list-header>
<ion-label>Video Games</ion-label>
<ion-button>See All</ion-button>
</ion-list-header>
<ion-item>
<ion-label>PokΓ©mon Yellow</ion-label>
</ion-item>
<ion-item>
<ion-label>Mega Man X</ion-label>
</ion-item>
<ion-item>
<ion-label>The Legend of Zelda</ion-label>
</ion-item>
<ion-item>
<ion-label>Pac-Man</ion-label>
</ion-item>
<ion-item>
<ion-label>Super Mario World</ion-label>
</ion-item>
</ion-list>
List Header Lines
List headers do not show a bottom border by default. The lines
property can be modified to "full"
or "inset"
which will show a full width border or an inset border with left padding, respectively.
<ion-list>
<ion-list-header>
<ion-label>Default</ion-label>
</ion-list-header>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
</ion-list>
<ion-list>
<ion-list-header lines="inset">
<ion-label>Inset</ion-label>
</ion-list-header>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
</ion-list>
<ion-list>
<ion-list-header lines="full">
<ion-label>Full</ion-label>
</ion-list-header>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
<ion-item>
<ion-label>Item</ion-label>
</ion-item>
</ion-list>
Theming
Colors
<ion-list-header>
<ion-label>Default</ion-label>
</ion-list-header>
<ion-list-header color="primary">
<ion-label>Primary</ion-label>
</ion-list-header>
<ion-list-header color="secondary">
<ion-label>Secondary</ion-label>
</ion-list-header>
<ion-list-header color="tertiary">
<ion-label>Tertiary</ion-label>
</ion-list-header>
<ion-list-header color="success">
<ion-label>Success</ion-label>
</ion-list-header>
<ion-list-header color="warning">
<ion-label>Warning</ion-label>
</ion-list-header>
<ion-list-header color="danger">
<ion-label>Danger</ion-label>
</ion-list-header>
<ion-list-header color="light">
<ion-label>Light</ion-label>
</ion-list-header>
<ion-list-header color="medium">
<ion-label>Medium</ion-label>
</ion-list-header>
<ion-list-header color="dark">
<ion-label>Dark</ion-label>
</ion-list-header>
CSS Custom Properties
- src/app/example.component.css
- src/app/example.component.html
ion-list-header {
--background: #19422d;
--color: #fff;
--border-width: 0 0 4px 0;
--border-color: #f24aec;
--border-style: double;
}
Properties
color
Description | 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 | "danger" ο½ "dark" ο½ "light" ο½ "medium" ο½ "primary" ο½ "secondary" ο½ "success" ο½ "tertiary" ο½ "warning" ο½ string & Record<never, never> ο½ undefined |
Default | undefined |
lines
Description | How the bottom border should be displayed on the list header. |
Attribute | lines |
Type | "full" ο½ "inset" ο½ "none" ο½ undefined |
Default | undefined |
mode
Description | The mode determines which platform styles to use. |
Attribute | mode |
Type | "ios" ο½ "md" |
Default | undefined |
Events
No events available for this component.
Methods
No public methods available for this component.
CSS Shadow Parts
No CSS shadow parts available for this component.
CSS Custom Properties
Name | Description |
---|---|
--background | Background of the list header |
--border-color | Color of the list header border |
--border-style | Style of the list header border |
--border-width | Width of the list header border |
--color | Color of the list header text |
--inner-border-width | Width of the inner list header border |
Slots
No slots available for this component.