Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame^] | 1 | |
| 2 | |
| 3 | |
| 4 | <h2 id="introduction">Introduction</h2> |
| 5 | <p>The Material Design Lite (MDL) <strong>shadow</strong> is not a component in the same sense as an MDL card, menu, or textbox; it is a visual effect that can be assigned to a user interface element. The effect simulates a three-dimensional positioning of the element, as though it is slightly raised above the surface it rests upon — a positive <em>z-axis</em> value, in user interface terms. The shadow starts at the edges of the element and gradually fades outward, providing a realistic 3-D effect.</p> |
| 6 | <p>Shadows are a convenient and intuitive means of distinguishing an element from its surroundings. A shadow can draw the user's eye to an object and emphasize the object's importance, uniqueness, or immediacy.</p> |
| 7 | <p>Shadows are a well-established feature in user interfaces, and provide users with a visual clue to an object's intended use or value. Their design and use is an important factor in the overall user experience.</p> |
| 8 | <h3 id="to-include-an-mdl-shadow-effect-">To include an MDL <strong>shadow</strong> effect:</h3> |
| 9 | <p> 1. Code an element, such as a <code><div></code>, that is to receive the shadow effect; size and style it as desired, and add any required content.</p> |
| 10 | <pre><code class="lang-html"><div> |
| 11 | Some content |
| 12 | </div> |
| 13 | </code></pre> |
| 14 | <p> 2. Add an MDL shadow class to the element using the <code>class</code> attribute.</p> |
| 15 | <pre><code class="lang-html"><div class="mdl-shadow--4dp"> |
| 16 | Some content |
| 17 | </div> |
| 18 | </code></pre> |
| 19 | <p>The shadowed component is ready for use.</p> |
| 20 | <h4 id="examples">Examples</h4> |
| 21 | <p>A div with a user-specified class and a small shadow.</p> |
| 22 | <pre><code class="lang-html"><div class="my-shadow-card mdl-shadow--2dp">Small shadow</div> |
| 23 | </code></pre> |
| 24 | <p>A div with a user-specified class and a medium-large shadow.</p> |
| 25 | <pre><code class="lang-html"><div class="my-shadow-card mdl-shadow--6dp">Medium-large shadow</div> |
| 26 | </code></pre> |
| 27 | <h2 id="configuration-options">Configuration options</h2> |
| 28 | <p>The MDL CSS classes apply various predefined visual shadows to the element. The table below lists the available classes and their effects.</p> |
| 29 | <table> |
| 30 | <thead> |
| 31 | <tr> |
| 32 | <th>MDL class</th> |
| 33 | <th>Effect</th> |
| 34 | <th>Remarks</th> |
| 35 | </tr> |
| 36 | </thead> |
| 37 | <tbody> |
| 38 | <tr> |
| 39 | <td><code>mdl-shadow--2dp</code></td> |
| 40 | <td>Assigns a small shadow to the object</td> |
| 41 | <td>Optional; if omitted, no shadow is present</td> |
| 42 | </tr> |
| 43 | <tr> |
| 44 | <td><code>mdl-shadow--3dp</code></td> |
| 45 | <td>Assigns a medium-small shadow to the object</td> |
| 46 | <td>Optional; if omitted, no shadow is present</td> |
| 47 | </tr> |
| 48 | <tr> |
| 49 | <td><code>mdl-shadow--4dp</code></td> |
| 50 | <td>Assigns a medium shadow to the object</td> |
| 51 | <td>Optional; if omitted, no shadow is present</td> |
| 52 | </tr> |
| 53 | <tr> |
| 54 | <td><code>mdl-shadow--6dp</code></td> |
| 55 | <td>Assigns a medium-large shadow to the object</td> |
| 56 | <td>Optional; if omitted, no shadow is present</td> |
| 57 | </tr> |
| 58 | <tr> |
| 59 | <td><code>mdl-shadow--8dp</code></td> |
| 60 | <td>Assigns a large shadow to the object</td> |
| 61 | <td>Optional; if omitted, no shadow is present</td> |
| 62 | </tr> |
| 63 | <tr> |
| 64 | <td><code>mdl-shadow--16dp</code></td> |
| 65 | <td>Assigns an extra-large shadow to the object</td> |
| 66 | <td>Optional; if omitted, no shadow is present</td> |
| 67 | </tr> |
| 68 | </tbody> |
| 69 | </table> |
| 70 | |
| 71 | |