Theming lists

Home Search

All the standard button swatches can be applied to lists. A list inherits its theme swatch from its parent page/content container. So the theme swatch defaults to "c" (silver in the default theme), if nothing else is set to the surrounding page/content containers. List dividers and split buttons are styled with bar swatch "b" by default (blue in the default theme). The default button swatch for count bubbles is "c" (silver in the default theme).

Below is a list which inherits the default "c" content swatch and uses the default swatches for the list divider and the count bubbles.

<ul data-role="listview" data-inset="true">

Theming list items

The list item color scheme can be changed to any button color theme swatch by adding the data-theme attribute to the list, and setting the letter theme swatch. Here is the same list as above with the swatch "a" applied.

<ul data-role="listview" data-inset="true" data-theme="a">

data-theme attributes also work at the LI-level, for styling a single item.

Theming dividers

The theme for list dividers can be set by adding the data-divider-theme to the list and specifying a swatch letter. Here is an example of the same list as above with swatch "e" set on the dividers.

<ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="e">

Theming count bubbles

The theme for count bubbles can be set by adding the data-count-theme to the list and specifying a swatch letter. Here is an example with swatch "b" set on the count bubbles.

<ul data-role="listview" data-inset="true" data-theme="d" data-divider-theme="e" data-count-theme="b">

Theming icons

The default icon for each list item containing a link is arrow-r. To override this, set the data-icon attribute on the desired list item to the name of a standard icon. To prevent icons from appearing altogether, set the data-icon attribute to "false". With a bit of custom styles it's also possible to use third party icons.

Markup for the listview:


<ul data-role="listview" data-inset="true" data-theme="b">
	<li data-role="list-divider">Divider</li>
	<li data-icon="home"><a href="#">data-icon="home"</a></li>
	<li data-icon="delete"><a href="#">data-icon="delete"</a></li>
	<li data-icon="plus"><a href="#">data-icon="plus"</a></li>
	<li data-icon="arrow-u"><a href="#">data-icon="arrow-u"</a></li>
	<li data-icon="arrow-d"><a href="#">data-icon="arrow-d"</a></li>
	<li data-icon="check"><a href="#">data-icon="check"</a></li>
	<li data-icon="gear"><a href="#">data-icon="gear"</a></li>
	<li data-icon="grid"><a href="#">data-icon="grid"</a></li>
	<li data-icon="star"><a href="#">data-icon="star"</a></li>
	<li data-icon="custom" id="coffeeicon"><a href="#">custom-icon</a></li>
	<li data-icon="arrow-r"><a href="#">data-icon="arrow-r"</a></li>
	<li data-icon="arrow-l"><a href="#">data-icon="arrow-l"</a></li>
	<li data-icon="minus"><a href="#">data-icon="minus"</a></li>
	<li data-icon="refresh"><a href="#">data-icon="refresh"</a></li>
	<li data-icon="forward"><a href="#">data-icon="forward"</a></li>
	<li data-icon="back"><a href="#">data-icon="back"</a></li>
	<li data-icon="alert"><a href="#">data-icon="alert"</a></li>
	<li data-icon="info"><a href="#">data-icon="info"</a></li>
	<li data-icon="search"><a href="#">data-icon="search"</a></li>
	<li data-icon="false"><a href="#">data-icon="false"</a></li>
</ul>

Styles for the custom icon:


<style>
	#coffeeicon .ui-icon-custom {
	background-image: url("../toolbars/glyphish-icons/34-coffee.png");
	background-position: 2px 2px;
	background-size: 90%; }
</style>

Custom icon by Joseph Wain / glyphish.com. Licensed under the Creative Commons Attribution 3.0 United States License.

Theming split buttons

For split lists with a second link button, the framework default to "b" for the theme swatch (blue in the default theme). Here is a default split list:

<ul data-role="listview" data-inset="true" data-split-theme="a">

To specify the color swatch for the icon button on the right, add the data-split-theme to the list and specify a swatch letter. This attribute can also be added to individual split inside list items by adding a data-theme attribute to specific links (see second list item).

The icon for the split can be set at the list level by adding the data-split-icon to the list and specifying a standard icon. The icon can also be set to an individual split by adding a data-icon attribute to specific list items (see second list item).

<ul data-role="listview" data-inset="true" data-split-theme="d" data-split-icon="delete">

Examples of all basic list swatches

Swatch "a" on listview

Swatch "b" on listview

Swatch "c" on listview

Swatch "d" on listview

Swatch "e" on listview