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:

A swatch

Button

B swatch

Button

C swatch

Button

D swatch

Button

E swatch

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">Theme a</a>			

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

Theme a Theme b Theme c Theme d Theme e

Theme variations

"a" theme on container with themed buttons inside

"b" theme on container with themed buttons inside

"c" theme on container with themed buttons inside

"d" theme on container with themed buttons inside

"e" theme on container with themed buttons inside