Theming buttons

Home Search

Theming buttons

jQuery Mobile has a rich theming system that gives you full control of how buttons are styled. When a link is added to a container, it is automatically assigned a theme swatch letter that matches its parent bar or content box to visually integrate the button into the parent container, like a chameleon. So a button placed inside a content container with a theme of "a" (black in the default theme) will be automatically assigned the button theme of "a" (charcoal in the default theme). Here are examples of the button theme pairings in the default theme. All buttons have the same HTML markup:

Swatch "a"

Button

Swatch "b"

Button

Swatch "c"

Button

Swatch "d"

Button

Swatch "e"

Button

Assigning theme swatches

Buttons can be manually assigned any of the button color swatches from the theme to add visual contrast with the container they sit inside by adding the data-theme attribute on the button markup and specifying a swatch letter.

			
<a href="index.html" data-role="button" data-theme="a">Swatch a</a>			

Here are 5 buttons with icons that have a different swatch letter assigned via the data-theme attribute.

Swatch a Swatch b Swatch c Swatch d Swatch e

Theme variations

Swatch "a" on container with themed buttons inside

Swatch "b" on container with themed buttons inside

Swatch "c" on container with themed buttons inside

Swatch "d" on container with themed buttons inside

Swatch "e" on container with themed buttons inside