jQuery Mobile Docs - Theming Lists

# Theming lists

Home Search

All the standard theme 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 on 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">`

- Divider
- Inbox 12
- Outbox 0
- Sent 328

## 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">`

- Divider
- Inbox 12
- Outbox 0
- Sent 328

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

- Divider
- Inbox 12
- Outbox 0
- Sent 328
- Trash 34

## 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">`

- Divider
- Inbox 12
- Outbox 0
- Sent 328

## 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">`

- Divider
- Inbox 12
- Outbox 0
- Sent 328

## 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>

- Divider
- data-icon="home"
- data-icon="delete"
- data-icon="plus"
- data-icon="arrow-u"
- data-icon="arrow-d"
- data-icon="check"
- data-icon="gear"
- data-icon="grid"
- data-icon="star"
- custom-icon
- data-icon="arrow-r"
- data-icon="arrow-l"
- data-icon="minus"
- data-icon="refresh"
- data-icon="forward"
- data-icon="back"
- data-icon="alert"
- data-icon="info"
- data-icon="search"
- data-icon="false"

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:

- ### Broken Bells

  Broken Bells

  Purchase album

- ### Warning

  Hot Chip

  Purchase album

`<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).

- ### Broken Bells

  Broken Bells

  Purchase album

- ### Warning

  Hot Chip

  Purchase album

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">`

- ### Broken Bells

  Broken Bells

  Purchase album

- ### Warning

  Hot Chip

  Purchase album

## Examples of all basic list swatches

Swatch "a" on listview

- Inbox 12
- Outbox 0
- Trash 62

Swatch "b" on listview

- Inbox 12
- Outbox 0
- Trash 62

Swatch "c" on listview

- Inbox 12
- Outbox 0
- Trash 62

Swatch "d" on listview

- Inbox 12
- Outbox 0
- Trash 62

Swatch "e" on listview

- Inbox 12
- Outbox 0
- Trash 62

### More in this section

- Listviews
- List basics & API
- Basic linked list
- Nested list
- Numbered list
- Split button list
- List dividers
- Autodividers
- Count bubble
- Thumbnails
- Icons
- List formatting
- Inset styled lists
- Search filter bar
- Inset search filter bar
- Search filter with dividers
- Search filter hidden data
- Read-only lists
- Read-only inset lists
- Lists with forms
- Inset lists with forms
- Collapsible lists
- List performance test
- Theming lists