2018-04-26 17:51:48 +00:00
module . exports = {
id : 'modal-dialogs' ,
title : 'Modal dialogs' ,
keywords : [ ` modal ` , ` dialog ` , ` contextual ` , ` alert ` , ` notification ` ] ,
description : ` <p><strong>mini.css</strong> provides you with a modal dialog component to display messages to users. It is composed of three components - the modal dialog, the toggle button and the close button:</p>
< ul > < li > To create a modal dialog , simply create a checkbox input , applying the appropriate class to it ( < code > . modal < / c o d e > ) , i m m e d i a t e l y f o l l o w e d b y a < c o d e > & l t ; d i v & g t ; < / c o d e > c o n t a i n e r . T h e f o r m e r s e r v e s a s y o u r m o d a l d i a l o g ' s c o n t r o l , w h i l e t h e l a t t e r i s t h e a c t u a l m o d a l d i a l o g c o n t a i n e r . < / l i >
< li > Create a label anywhere outside your modal dialog ' s container for the checkbox controlling your modal dialog . This will serve as the toggle button for your modal dialog . < / l i >
< li > Finally , inside your modal dialog ' s container , add another label for the checkbox controlling your modal dialog , applying the appropriate class ( . modal - close ) . This will serve as the close button for your modal dialog . < / l i >
< / u l > ` ,
example : ` <input type="checkbox" class="modal" id="modal-example"><div class="modal doc"><div class="card doc"><label for="modal-example" class="modal-close doc"></label><h3 class="section double-padded doc">Modal</h3><p class="section double-padded doc">This is a modal dialog!</p></div></div><label for="modal-example" class="button doc">Show modal dialog</label> ` ,
samples : [ ` <pre><span class="code-line"><span class="highlight-a"><label</span> <span class="highlight-b">for</span>=<span class="highlight-c">"modal-control"</span><span class="highlight-a">></span>Show modal<span class="highlight-a"></label></span></span>
< span class = "code-line" > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; input < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > t y p e < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c h e c k b o x & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > i d < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c a r d & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; h3 < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > M o d a l < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / h 3 & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; p < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > T h i s i s a m o d a l d i a l o g ! < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / p & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > ` ] ,
notes : [
` Modal dialogs should be used in combination with the <a href="#card">card</a> component for best results. ` ,
` Remember to apply the appropriate classes to any and all elements, as indicated in the examples. Failing to do so will result in the modal dialog not rendering or behaving properly. ` ,
` You can omit the toggle for the modal dialog and use Javascript to show/hide it, instead. You can also use any correctly linked label inside the modal dialog to change its state. `
] ,
customization : [
` Background color for the modal dialog overlay can be changed by changing the value of <code>--modal-overlay-color</code>. ` ,
` Text color for the modal dialog close button can be changed by changing the value of the <code>--modal-close-color</code>. ` ,
` Background color for the modal dialog close button when focused or hovered over can be changed by changing the value of the <code>--modal-close-hover-color</code>. ` ,
` Universal margin for elements can be changed globally by changing the value of the <code>--universal-margin</code> variable. As a rule of thumb, consider the universal margin to be the distance you want your paragraphs to have from the sides of the screen. ` ,
` Universal padding for elements can be changed globally by changing the value of the <code>--universal-padding</code> variable. ` ,
` Universal border radius for elements can be changed globally by changing the value of the <code>--universal-border-radius</code> variable. `
] ,
modifiers : [ ] ,
dos : [
{
description : ` You can use the <code>role="dialog"</code> to add accessibility to your modal dialogs. Remember to properly label it and manage keyboard focus, as required. ` ,
sample : ` <pre><span class="code-line"><span class="highlight-a"><input</span> <span class="highlight-b">type</span>=<span class="highlight-c">"checkbox"</span> <span class="highlight-b">id</span>=<span class="highlight-c">"modal-control"</span> <span class="highlight-b">class</span>=<span class="highlight-c">"modal"</span><span class="highlight-a">></span></span>
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > r o l e < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d i a l o g & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > a r i a - l a b e l l e d b y < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d i a l o g - t i t l e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c a r d & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; h3 < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > i d < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; d i a l o g - t i t l e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > M o d a l < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / h 3 & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; p < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > T h i s i s a m o d a l d i a l o g ! < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / p & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
}
] ,
donts : [
{
description : ` You should not place anything between the checkbox controlling the modal dialog and the container. ` ,
sample : ` <pre><span class="code-line"><span class="highlight-a"><input</span> <span class="highlight-b">type</span>=<span class="highlight-c">"checkbox"</span> <span class="highlight-b">id</span>=<span class="highlight-c">"modal-control"</span> <span class="highlight-b">class</span>=<span class="highlight-c">"modal"</span><span class="highlight-a">></span></span>
< span class = "code-line" > < span class = "highlight-c" > & lt ; ! -- Do not place other stuff between these -- & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div & gt ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; div < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; c a r d & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; label < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > f o r < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c o n t r o l & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; m o d a l - c l o s e & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / l a b e l & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; h3 < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > M o d a l < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / h 3 & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; p < / s p a n > < s p a n c l a s s = " h i g h l i g h t - b " > c l a s s < / s p a n > = < s p a n c l a s s = " h i g h l i g h t - c " > & q u o t ; s e c t i o n & q u o t ; < / s p a n > < s p a n c l a s s = " h i g h l i g h t - a " > & g t ; < / s p a n > T h i s i s a m o d a l d i a l o g ! < s p a n c l a s s = " h i g h l i g h t - a " > & l t ; / p & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n >
< span class = "code-line" > < span class = "highlight-a" > & lt ; / d i v & g t ; < / s p a n > < / s p a n > < / p r e > `
}
]
}