You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

416 lines
14 KiB

---
layout : 'default'
css : 'accordion'
title : 'Accordion'
description : 'An accordion displays a single piece of content, while allowing the option of displaying other related content'
type : 'UI Module'
---
<script src="/javascript/accordion.js"></script>
<%- @partial('header', { tabs: 'module' }) %>
<div class="main container">
<div class="ui active tab" data-tab="definition">
<div class="peek">
<div class="ui vertical pointing secondary menu">
<a class="active item">Types</a>
<a class="item">Variations</a>
<a class="item">Behaviors</a>
</div>
</div>
<h2 class="ui dividing header">Types</h2>
<div class="example">
<h4 class="ui header">Accordion</h4>
<p>A standard accordion</p>
<div class="ui accordion">
<div class="active title">
<i class="dropdown icon"></i>
What is a dog?
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
What kinds of dogs are there?
</div>
<div class="content">
<p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
How do you acquire a dog?
</div>
<div class="content">
<p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
<p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
</div>
</div>
</div>
<div class="example">
<h4 class="ui header">Basic</h4>
<p>A basic accordion does not add any extra formatting</p>
<div class="ui basic accordion">
<div class="active title">
<i class="dropdown icon"></i>
What is a dog?
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
What kinds of dogs are there?
</div>
<div class="content">
<p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
How do you acquire a dog?
</div>
<div class="content">
<p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
<p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
</div>
</div>
</div>
<h2 class="ui dividing header">Variations</h2>
<div class="example">
<h4 class="ui header">Fluid</h4>
<p>An accordion can take up the width of its container</p>
<div class="ui fluid accordion">
<div class="active title">
<i class="dropdown icon"></i>
What is a dog?
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
What kinds of dogs are there?
</div>
<div class="content">
<p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
How do you acquire a dog?
</div>
<div class="content">
<p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
<p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
</div>
</div>
</div>
<h2 class="ui dividing header">Behavior</h2>
All the following behaviors can be called using the syntax <code>$('.foo').accordion('behavior name', argumentOne, argumentTwo)</code>
<table class="ui definition celled table segment">
<tr>
<td>open (index)</td>
<td>Opens accordion content at index</td>
</tr>
<tr>
<td>close (index)</td>
<td>Closes accordion content at index</td>
</tr>
<tr>
<td>toggle (index)</td>
<td>Closes accordion content at index</td>
</tr>
</table>
</div>
<div class="ui tab" data-tab="examples">
<div class="example">
<h4 class="ui header">Form</h4>
<p>An accordion can be used anywhere where content can be shown or hidden. For example, to show optional form fields.</p>
<div class="ui basic accordion form">
<div class="two fields">
<div class="field">
<label>First Name</label>
<input placeholder="First Name" type="text">
</div>
<div class="field">
<label>Last Name</label>
<input placeholder="Last Name" type="text">
</div>
</div>
<div class="title">
<i class="icon dropdown"></i>
Optional Details
</div>
<div class="content">
<div class="field">
<label>Maiden Name</label>
<input placeholder="Maiden Name" type="text">
</div>
</div>
</div>
</div>
<div class="example">
<h4 class="ui header">Menu</h4>
<p>An accordion can be used to create content drawers inside a menu</p>
<div class="ui basic vertical accordion menu">
<div class="item">
<a class="active title">
<i class="dropdown icon"></i>
Size
</a>
<div class="active content menu">
<div class="ui form item">
<div class="grouped inline fields">
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="small" />
<label></label>
</div>
<label>Small</label>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="medium" />
<label></label>
</div>
<label>Medium</label>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="large" />
<label></label>
</div>
<label>Large</label>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="size" value="x-large" />
<label></label>
</div>
<label>X-Large</label>
</div>
</div>
</div>
</div>
</div>
<div class="item">
<a class="active title">
<i class="dropdown icon"></i>
Colors
</a>
<div class="active content menu">
<div class="ui form item">
<div class="grouped inline fields">
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="small" />
<label></label>
</div>
<label>Red</label>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="medium" />
<label></label>
</div>
<label>Orange</label>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="large" />
<label></label>
</div>
<label>Green</label>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="x-large" />
<label></label>
</div>
<label>Blue</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui tab" data-tab="usage">
<h3 class="ui header">Initializing an accordion</h3>
<div class="code">
$('.ui.accordion')
.accordion()
;
</div>
</div>
<div class="ui tab" data-tab="settings">
<h3 class="ui header">
Accordion Settings
<div class="sub header">Accordion settings modify its behavior</div>
</h3>
<table class="ui sortable celled definition table segment">
<thead>
<th>Setting</th>
<th class="four wide">Default</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>exclusive</td>
<td>true</td>
<td>Set to false to allow multiple sections to be open at the same time</td>
</tr>
<tr>
<td>collapsible</td>
<td>true</td>
<td>Set to false to require an accordion to always have a section open</td>
</tr>
<tr>
<td>duration</td>
<td>500</td>
<td>Duration in ms of opening animation</td>
</tr>
<tr>
<td>easing</td>
<td>easeInOutQuint</td>
<td>EaseInOutQuint is included with accordion, for additional options consider <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing</a>)</td>
</tr>
</tbody>
</table>
<h3 class="ui header">
Callbacks
<div class="sub header">Callback settings specify a function to occur after a specific behavior.</div>
</h3>
<table class="ui sortable celled definition table segment">
<thead>
<th class="four wide">Setting</th>
<th>Context</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>onOpen</td>
<td>active content</td>
<td>Callback on element open</td>
</tr>
<tr>
<td>onClose</td>
<td>active content</td>
<td>Callback on element close</td>
</tr>
<tr>
<td>onChange</td>
<td>active content</td>
<td>Callback on element open or close</td>
</tr>
</tbody>
</table>
<h3 class="ui header">
DOM Settings
<div class="sub header">DOM settings specify how this module should interface with the DOM</div>
</h3>
<table class="ui sortable celled definition table segment">
<thead>
<th>Setting</th>
<th class="six wide">Default</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>namespace</td>
<td>accordion</td>
<td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
</tr>
<tr>
<td>selector</td>
<td>
<div class="code" data-type="css">{
title : '.title',
content : '.content'
}
</div>
</td>
<td>Object containing selectors used by module.</td>
</tr>
<tr>
<td>className</td>
<td>
<div class="code">
className : {
active : 'active'
},
</div>
</td>
<td>Class names used to attach style to state</td>
</tr>
</tbody>
</table>
<h3 class="ui header">
Debug Settings
<div class="sub header">Debug settings controls debug output to the console</div>
</h3>
<table class="ui sortable celled definition table segment">
<thead>
<th>Setting</th>
<th class="four wide">Default</th>
<th>Description</th>
</thead>
<tbody>
<tr>
<td>name</td>
<td>Accordion</td>
<td>Name used in debug logs</td>
</tr>
<tr>
<td>debug</td>
<td>True</td>
<td>Provides standard debug output to console</td>
</tr>
<tr>
<td>performance</td>
<td>True</td>
<td>Provides standard debug output to console</td>
</tr>
<tr>
<td>verbose</td>
<td>True</td>
<td>Provides ancillary debug output to console</td>
</tr>
<tr>
<td>errors</td>
<td colspan="2">
<div class="code">
error : {
method : 'The method you called is not defined.',
notFound : 'There were no elements that matched the specified selector'
}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>