Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 72535d1

Browse files
committed
Added improved collpsible theming docs
1 parent a975878 commit 72535d1

File tree

2 files changed

+149
-89
lines changed

2 files changed

+149
-89
lines changed

docs/content/content-collapsible-set.html

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,67 +28,93 @@ <h2>Collapsible set markup</h2>
2828
<p>By default, all the sections will be collapsed. To set a section to be open when the page loads, add the <code> data-collapsed="false"</code> attribute to the heading of the section you want expanded.</p>
2929

3030
<pre><code>
31-
&lt;div data-role="collapsible-set"&gt;
31+
<strong>&lt;div data-role="collapsible-set"&gt;</strong>
3232

33-
&lt;div data-role=&quot;collapsible&quot; data-collapsed=&quot;false&quot;&gt;
34-
&lt;h3&gt;Section A&lt;/h3&gt;
33+
&lt;div data-role=&quot;collapsible&quot; <strong>data-collapsed=&quot;false&quot;</strong>&gt;
34+
&lt;h3&gt;Section 1&lt;/h3&gt;
3535
&lt;p&gt;I&#x27;m the collapsible set content for section B.&lt;/p&gt;
3636
&lt;/div&gt;
3737

3838
&lt;div data-role=&quot;collapsible&quot;&gt;
39-
&lt;h3&gt;Section B&lt;/h3&gt;
39+
&lt;h3&gt;Section 2&lt;/h3&gt;
4040
&lt;p&gt;I&#x27;m the collapsible set content for section B.&lt;/p&gt;
4141
&lt;/div&gt;
4242

43-
&lt;/div&gt;
43+
<strong>&lt;/div&gt;</strong>
4444
</code></pre>
4545

4646

4747
<p>Here is an example of a collapsible set with 5 sections.</p>
4848

4949
<div data-role="collapsible-set">
5050
<div data-role="collapsible" data-collapsed="false">
51-
<h3>Section A</h3>
52-
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
51+
<h3>Section 1</h3>
52+
<p>I'm the collapsible content in a set so this feels like an accordion. I'm open by default because I have the <code>data-collapsed="false"</code> attribute.</p>
5353
</div>
5454
<div data-role="collapsible">
55-
<h3>Section B</h3>
55+
<h3>Section 2</h3>
5656
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
5757

5858
</div>
5959
<div data-role="collapsible">
60-
<h3>Section C</h3>
60+
<h3>Section 3</h3>
6161
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
6262

6363
</div>
6464
<div data-role="collapsible">
65-
<h3>Section D</h3>
65+
<h3>Section 4</h3>
6666
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
6767

6868
</div>
6969
<div data-role="collapsible">
70-
<h3>Section E</h3>
70+
<h3>Section 5</h3>
7171
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
7272

7373
</div>
7474
</div>
7575

76-
<p>Here is an example of a collapsible with 3 sections and <code>data-content-theme</code> set</p>
76+
<h2>Theming collapsible content</h2>
77+
<p>The standard <code>data-theme</code> attribute can be used to set the color of each collapsible in a set. To provide a clearer visual grouping of the content with the headers, add the <code>data-content-theme</code> attribute with a swatch letter. This adds a themed background color and border to the content block. For consistent theming, add these attributes to the parent collapsible set.</p>
7778

78-
<div data-role="collapsible-set" data-content-theme="c">
79-
<div data-role="collapsible" data-collapsed="false">
80-
<h3>Section F</h3>
81-
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
79+
80+
<pre><code>
81+
&lt;div data-role=&quot;collapsible-set&quot; <strong>data-theme=&quot;c&quot; data-content-theme=&quot;d&quot;</strong>&gt;
82+
</code></pre>
83+
84+
85+
<div data-role="collapsible-set" data-theme="c" data-content-theme="d">
86+
<div data-role="collapsible">
87+
<h3>Section 1</h3>
88+
<p>Collapsible content</p>
8289
</div>
8390
<div data-role="collapsible">
84-
<h3>Section G</h3>
85-
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
91+
<h3>Section 2</h3>
92+
<p>Collapsible content</p>
8693

8794
</div>
8895
<div data-role="collapsible">
89-
<h3>Section H</h3>
90-
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I have the "collapsed" state; you need to expand the header to see me.</p>
96+
<h3>Section 3</h3>
97+
<p>Collapsible content</p>
98+
</div>
99+
</div>
100+
101+
102+
<h2>Theming individual sections</h2>
103+
<p>To have individual sections in a group styled differently, add <code>data-theme</code> and <code>data-content-theme</code> attributes to specific collapsibles.</p>
91104

105+
<div data-role="collapsible-set" data-content-theme="c">
106+
<div data-role="collapsible" data-theme="b" data-content-theme="b">
107+
<h3>Section header, swatch B</h3>
108+
<p>Collapsible content, swatch B</p>
109+
110+
</div>
111+
<div data-role="collapsible" data-theme="a" data-content-theme="a">
112+
<h3>Section header, swatch A</h3>
113+
<p>Collapsible content, swatch A</p>
114+
</div>
115+
<div data-role="collapsible" data-theme="e" data-content-theme="d">
116+
<h3>Section header, swatch E</h3>
117+
<p>Collapsible content, swatch D</p>
92118
</div>
93119
</div>
94120

docs/content/content-collapsible.html

Lines changed: 103 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,24 @@ <h2>Collapsible content markup</h2>
3131
<p>Directly inside this container, add any header element (H1-H6). The framework will style the header to look like a clickable button and add a "+" icon to the left to indicate it's expandable.</p>
3232

3333
<p>After the header, add any HTML markup you want to be collapsible. The framework will wrap this markup in a container that will be hidden/shown when the heading is clicked.</p>
34-
35-
<pre><code>
36-
&lt;div data-role=&quot;collapsible&quot;&gt;
37-
&lt;h3&gt;I&#x27;m a header&lt;/h3&gt;
38-
&lt;p&gt;I&#x27;m the collapsible content. By default I'm closed, but you can click the header to open me.&lt;/p&gt;
39-
&lt;/div&gt;
40-
</code></pre>
34+
35+
<p>By default, the content will be collapsed.</p>
36+
<pre><code>
37+
&lt;div <strong>data-role=&quot;collapsible&quot;</strong>&gt;
38+
&lt;h3&gt;I&#x27;m a header&lt;/h3&gt;
39+
&lt;p&gt;I&#x27;m the collapsible content. By default I'm closed, but you can click the header to open me.&lt;/p&gt;
40+
&lt;/div&gt;
41+
</code></pre>
4142

4243

4344
<div data-role="collapsible">
4445
<h3>I'm a header</h3>
4546
<p>I'm the collapsible content. By default I'm closed, but you can click the header to open me.</p>
4647
</div>
4748

48-
49-
<p>As the example notes, by default the content will be collapsed. To expand the content when the page loads, add the <code>data-collapsed="false"</code> attribute to the wrapper.</p>
49+
<h2>Expanding collapsibles on load</h2>
50+
51+
<p>To expand the content when the page loads, add the <code>data-collapsed="false"</code> attribute to the wrapper.</p>
5052

5153
<code>
5254
&lt;div data-role=&quot;collapsible&quot; <strong>data-collapsed=&quot;false&quot;&gt;</strong>
@@ -60,71 +62,103 @@ <h3>I'm a header</h3>
6062
<p>I'm the collapsible content. I'm expanded by default because I have the "collapsed" state set to false.</p>
6163
</div>
6264

65+
<h2>Theming collapsible content</h2>
66+
67+
6368
<p>Collapsible content is minimally styled &mdash; we add only a bit of margin between the bar and content, and the header adopts the default Theme styles of the container it sits within.</p>
69+
70+
<p>To provide a stronger visual connection between the collapsible header and content, add the <code>data-content-theme</code> attribute to the wrapper and specify a theme swatch letter. This will apply the swatch's border and <em>flat</em> background color (not the gradient) to the content block and changes the corner rounding to square off the bottom of the header and round the bottom of the content block instead to visually group these elements.</p>
71+
72+
<pre><code>
73+
&lt;div data-role=&quot;collapsible&quot; <strong>data-content-theme=&quot;a&quot;</strong>&gt;
74+
&lt;h3&gt;Header swatch A&lt;/h3&gt;
75+
&lt;p&gt;I&#x27;m the collapsible content with a themed content block set to "A".&lt;/p&gt;
76+
&lt;/div&gt;
77+
</code></pre>
78+
79+
<div data-role="collapsible" data-content-theme="c">
80+
<h3>Header swatch</h3>
81+
<p>I'm the collapsible content with a themed content block set to "C".</p>
82+
</div>
83+
84+
<h2>Theming collapsible headers</h2>
85+
<p>To set the theme on a collapsible header button, add the <code>data-theme</code> attribute to the wrapper and specify a swatch letter. Note that you can mix and match swatch letters between the header and content with these theme attributes.</p>
86+
87+
<pre><code>
88+
&lt;div data-role=&quot;collapsible&quot; <strong>data-theme=&quot;a&quot; data-content-theme=&quot;a&quot;</strong>&gt;
89+
&lt;h3&gt;Header swatch A&lt;/h3&gt;
90+
&lt;p&gt;I&#x27;m the collapsible content with a themed content block set to "A".&lt;/p&gt;
91+
&lt;/div&gt;
92+
</code></pre>
93+
94+
<div data-role="collapsible" data-theme="a" data-content-theme="a">
95+
<h3>Header swatch A</h3>
96+
<p>I'm the collapsible content with a themed content block set to "A".</p>
97+
</div>
98+
99+
100+
101+
<div data-role="collapsible" data-theme="b" data-content-theme="d">
102+
<h3>Header swatch B</h3>
103+
<p>I'm the collapsible content with a themed content block set to "D".</p>
104+
</div>
64105

65-
<h2>Collapsible example</h2>
66-
<p>This page has 5 collapsible containers with different types of content inside.</p>
67-
68-
<div data-role="collapsible">
69-
<h3>Section 1: Collapsed text block</h3>
70-
<p>I'm closed when the page loads because that's the default state of a collapsible.</p>
71-
<p>I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. </p>
72-
</div><!-- /section 1 -->
73-
74-
<div data-role="collapsible" data-collapsed="false">
75-
<h3>Section 2: Expanded on load</h3>
76-
<p>I'm opened when the page loads because I have the <code>data-collapsed="false"</code> attribute on my container. </p>
77-
<p>I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content. I'm the collapsible content.</p>
78-
</div><!-- /section 2 -->
79-
80-
<div data-role="collapsible" data-collapsed="true">
81-
<h3>Section 3: Form elements</h3>
82-
<form action="#" method="get">
83-
<div data-role="fieldcontain">
84-
<label for="textarea">Textarea:</label>
85-
<textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
86-
</div>
87-
<div data-role="fieldcontain">
88-
<label for="slider">Input slider:</label>
89-
<input type="range" name="slider" id="slider" value="0" min="0" max="100" />
90-
</div>
91-
<fieldset class="ui-grid-a">
92-
<div class="ui-block-a"><button type="submit" data-theme="c">Cancel</button></div>
93-
<div class="ui-block-b"><button type="submit" data-theme="b">Submit</button></div>
94-
</fieldset>
95-
</form>
96-
</div><!-- /section 3 -->
97-
98-
<div data-role="collapsible" data-collapsed="true">
99-
<h3>Section 4: Collapsed list</h3>
100-
<ul data-role="listview" data-inset="true" data-theme="d">
101-
<li><a href="index.html">Acura</a></li>
102-
<li><a href="index.html">Audi</a></li>
103-
<li><a href="index.html">BMW</a></li>
104-
<li><a href="index.html">Cadillac</a></li>
105-
<li><a href="index.html">Chrysler</a></li>
106-
<li><a href="index.html">Dodge</a></li>
107-
<li><a href="index.html">Ferrari</a></li>
108-
<li><a href="index.html">Ford</a></li>
109-
</ul>
110-
</div><!-- /section 4 -->
111-
112-
<div data-role="collapsible" data-theme="c" data-content-theme="c">
113-
<h3>Section 5: themed content</h3>
114-
<p>I have <code>data-content-theme</code> attribute set manually on my container to set the color to match the content block I'm in. </p>
115-
</div><!-- /section 5 -->
106+
116107

117108
<h2>Nested Collapsibles</h2>
118-
<div data-role="collapsible" data-collapsed="false">
109+
110+
<p>Collapsibles can be nested inside each other if needed. In this example, we're setting the content theme to provide clearer visual connection between the levels.</p>
111+
<div data-role="collapsible" data-collapsed="false" data-theme="e" data-content-theme="c">
119112
<h3>I'm a header</h3>
120113
<p>I'm the collapsible content. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
121-
<div data-role="collapsible" data-collapsed="false">
122-
<h3>I'm a nested collapsible header</h3>
123-
<p>I'm the collapsible content in a nested collapsible. By default I'm open and displayed on the page, but you can click the header to hide me.</p>
124-
</div>
114+
115+
<div data-role="collapsible" data-theme="c" data-content-theme="c">
116+
<h3>I'm a nested collapsible with a child collapsible</h3>
117+
<p>I'm a child collapsible.</p>
118+
<div data-role="collapsible" data-theme="d" data-content-theme="d">
119+
<h3>Nested inside again.</h3>
120+
<p>Three levels deep now.</p>
121+
</div><!-- /section 1A -->
122+
</div><!-- /section 1 -->
123+
124+
125+
<div data-role="collapsible" data-content-theme="c">
126+
<h3>Section 3: Form elements</h3>
127+
<form action="#" method="get">
128+
<div data-role="fieldcontain">
129+
<label for="textarea">Textarea:</label>
130+
<textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
131+
</div>
132+
<div data-role="fieldcontain">
133+
<label for="slider">Input slider:</label>
134+
<input type="range" name="slider" id="slider" value="0" min="0" max="100" />
135+
</div>
136+
<fieldset class="ui-grid-a">
137+
<div class="ui-block-a"><button type="submit" data-theme="c">Cancel</button></div>
138+
<div class="ui-block-b"><button type="submit" data-theme="b">Submit</button></div>
139+
</fieldset>
140+
</form>
141+
</div><!-- /section 2 -->
142+
143+
<div data-role="collapsible" data-content-theme="c">
144+
<h3>Section 4: Collapsed list</h3>
145+
<p>Here is an inset list:</p>
146+
<ul data-role="listview" data-inset="true" data-theme="d">
147+
<li><a href="index.html">Acura</a></li>
148+
<li><a href="index.html">Audi</a></li>
149+
<li><a href="index.html">BMW</a></li>
150+
<li><a href="index.html">Cadillac</a></li>
151+
<li><a href="index.html">Chrysler</a></li>
152+
<li><a href="index.html">Dodge</a></li>
153+
<li><a href="index.html">Ferrari</a></li>
154+
<li><a href="index.html">Ford</a></li>
155+
</ul>
156+
</div><!-- /section 3 -->
125157
</div>
126158

127-
<h2>Collapsible sets</h2>
159+
160+
161+
<h2>Collapsible sets (accordions)</h2>
128162
<p>It's possible to combine multiple collapsibles into a grouped sets that acts like an accordion widget. <a href="content-collapsible-set.html">Learn more</a></p>
129163

130164

@@ -141,13 +175,13 @@ <h3>More in this section</h3>
141175
<li data-role="list-divider">Content Formatting</li>
142176
<li><a href="content-html.html">Basic HTML styles</a></li>
143177
<li><a href="content-grids.html">Layout grids (columns)</a></li>
144-
<li data-theme="a"><a href="content-collapsible.html">Collapsible content blocks</a></li>
145-
<li><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
178+
<li><a href="content-collapsible.html">Collapsible content blocks</a></li>
179+
<li data-theme="a"><a href="content-collapsible-set.html">Collapsible sets (accordions)</a></li>
146180
<li><a href="content-themes.html">Theming content</a></li>
147181

148182
</ul>
149183
</div>
150-
</div>
184+
</div>
151185

152186
</div><!-- /content -->
153187

0 commit comments

Comments
 (0)