The tabs structure consists of an unordered list of tabs that have hashes corresponding to tab ids. Then when you click on each tab,only the container with the corresponding tab id will become visible.

Basic Tabs

When you click on each tab,only the container with the corresponding tab id will become visible.

Oat cake oat cake marzipan macaroon fruitcake. Ice cream gummi bears ice cream ice cream danish jelly beans caramels tootsie roll. Pie macaroon croissant tart cake jelly beans fruitcake.

Pudding chocolate bear claw dragée biscuit. Jelly powder cake. Liquorice biscuit donut jelly-o chocolate. Liquorice cake gummies tart cupcake.

Cupcake ipsum dolor sit amet. Powder donut cake. Pudding toffee jujubes marzipan pudding.

Brownie marshmallow sweet macaroon. Danish carrot cake chocolate bar dessert croissant toffee pie caramels. Bonbon tart croissant chupa chups dessert.

<div class="row"><div class="col s12"><ul class="tabs"><li class="tab col m3"><a href="#test1">Test 1</a></li><li class="tab col m3"><a class="active" href="#test2">Test 2</a></li><li class="tab col sm disabled"><a href="#test3">Disabled Tab</a></li><li class="tab col m3"><a href="#test4">Test 4</a></li></ul></div><div id="test1" class="col s12">Test 1</div><div id="test2" class="col s12">Test 2</div><div id="test3" class="col s12">Test 3</div><div id="test4" class="col s12">Test 4</div></div>
$(document).ready(function(){$('tabs').tabs()});

Fixed Width Tabs

Add the .tabs-fixed-widthclass

Fruitcake lemon drops tootsie roll liquorice sugar plum wafer tiramisu. Gummies lollipop chocolate macaroon donut cake cookie oat cake. Jelly-o lollipop topping dragée.

Sugar plum sugar plum carrot cake. Cupcake topping marshmallow sweet roll bear claw sugar plum jelly beans. Jelly-o chocolate muffin.

Cupcake ipsum dolor. Sit amet cookie gummies lollipop topping soufflé. Tootsie roll brownie gummi bears jelly beans danish caramels jelly beans.

Cupcake ipsum dolor sit amet. Wafer jelly beans candy canes. Bonbon dragée sweet roll gingerbread muffin caramels sweet. Croissant marshmallow tootsie roll lollipop chocolate.

jQuery Plugin Methods

You can programmatically trigger a tab change with our selectmethod. You have to input the id of the tab you want to switch to. In the case of our demo it would be either test1,test2,test3,or test4.

instance.select('tab_id');

jQuery Plugin Options

You can programmatically trigger a tab change with our selectmethod. You have to input the id of the tab you want to switch to. In the case of our demo it would be either test1,test2,test3,or test4.

Option NameDescription
onShowExecute a callback function when the tab is changed.
The callback provides a parameter which refers to the current tab being shown.
swipeableSet to true to enable swipeable tabs. This also uses the responsiveThreshold option. Default:false
responsiveThresholdThe maximum width of the screen,in pixels,where the swipeable functionality initializes. Default:Infinity

Linking to an External Page

By default,Materialize tabs will ignore their default anchor behaviour. To force a tab to behave as a regular hyperlink,just specify the targetproperty of that link!A list of targetvalues may be found here.

<li class="tab col s2"><a target="_blank" href="https://github.com/Dogfalo/materialize">External link in new window</a></li><li class="tab col s2"><a target="_self" href="https://github.com/Dogfalo/materialize">External link in same window</a></li>

Preselecting a tab

When you click on each tab,only the container with the corresponding tab id will become visible.

By default,the first tab is selected. But if this is not what you want,you can preselect a tab by either passing in the hash in the url ex:#test2. Or you can add the class activeto the atag.

Cupcake ipsum dolor sit. Amet gummi bears chupa chups. Tart cotton candy fruitcake cupcake croissant sweet biscuit candy candy.

Icing tart toffee brownie carrot cake. Brownie jelly soufflé. Ice cream bear claw macaroon pastry. Bonbon jelly cookie gummies sweet roll muffin pie.

Cupcake ipsum dolor sit amet candy canes cake. Marshmallow brownie gummi bears jelly beans sugar plum macaroon donut. Liquorice liquorice lollipop.

<li class="tab col s2"><a class="active" href="#test3">Test 3</a></li>

Swipeable Tabs

By setting the swipeableoption to true,you can enable tabs where you can swipe on touch enabled devices to switch tabs. Make sure you keep the tab content divs in the same wrapping container. You can also set the responsiveThresholdoption to a screen width in pixels where the swipeable functionality will activate.


Note:This is also touch compatible!Try swiping with your finger to scroll through the carousel.