Skip to content

Commit c36c473

Browse files
authored
docs(density): Add sass mixin links to density page (material-components#5219)
1 parent 62d3a09 commit c36c473

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

packages/mdc-density/README.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,24 @@ path: /catalog/density/
1010

1111
Density subsystem provides adaptive layout to components. Material Design uses low-density space by default but offers high-density space when it improves the user experience. Components with high density enable users to process and take action against large amounts of information in a more manageable way. List, tables, and long forms are components that benefit from increased density.
1212

13+
## Design & API Documentation
14+
15+
<ul class="icon-list">
16+
<li class="icon-list-item icon-list-item--spec">
17+
<a href="https://material.io/design/layout/applying-density.html">Material Design guidelines: Applying density</a>
18+
</li>
19+
<li class="icon-list-item icon-list-item--link">
20+
<a href="https://glitch.com/~material-density" target="_blank">Demo: Glitch</a>
21+
</li>
22+
</ul>
23+
1324
## Installation
1425

1526
```
1627
npm install @material/density
1728
```
1829

19-
> NOTE: You do not need to directly depend on `@material/density`, Use component provided density Sass mixins instead.
30+
> NOTE: You do not need to directly depend on `@material/density`, use component provided density Sass mixins instead.
2031
2132
## Basic Usage
2233

@@ -36,6 +47,19 @@ This would apply `-3` (high density) to button component instance.
3647
> You would indirectly use the Density API through respective component's mixin which takes care of setting appropriate
3748
> component height.
3849
50+
Here are the components that do provide density Sass mixins:
51+
52+
* [Button](../mdc-button/README.md#sass-mixins)
53+
* [Checkbox](../mdc-checkbox/README.md#sass-mixins)
54+
* [Chip](../mdc-chips/README.md#sass-mixins)
55+
* [Data Table](../mdc-data-table/README.md#sass-mixins)
56+
* [Icon Button](../mdc-icon-button/README.md#sass-mixins)
57+
* [List](../mdc-list/README.md#sass-mixins)
58+
* [Radio](../mdc-radio/README.md#sass-mixins)
59+
* [Switch](../mdc-switch/README.md#sass-mixins)
60+
* [Tab Bar](../mdc-tab-bar/README.md#sass-mixins)
61+
* [Text Field](../mdc-textfield/README.md#sass-mixins)
62+
3963
## Density Mixins
4064

4165
Components that supports density provides Sass mixins to customize density for that component. Each density mixin takes in a density scale number, e.g. 0 (the default) or -1 (higher density).
@@ -55,6 +79,23 @@ It is recommended to customize density via the provided density mixins, rather t
5579

5680
NOTE: Touch targets are automatically disabled when density mixins are applied, since dense components should be optionally enabled and therefore do not have the same default accessibility requirements.
5781

82+
## Component variants
83+
84+
Components that has different variants may have their own density mixin.
85+
86+
For example, Tab Bar has two density mixins:
87+
88+
* `mdc-tab-bar-density()`: Density mixin for standard tab bar.
89+
* `mdc-tab-bar-stacked-density()`: Density mixin for tab bar that has icon stacked on top of label.
90+
91+
Similarly, text field provides 3 different density mixins based on its variant.
92+
93+
## Nested components
94+
95+
Material component that renders another component inside it needs set its own density scale accordingly. Applying density mixin on parent component does not automatically apply density to its children.
96+
97+
For example, Applying density to data table does not automatically set density scale to row checkbox. You'll have to explicitly set density scale to its children. This'll allow clients to have full control on the layout.
98+
5899
## Style Customization
59100

60101
This package is used as utility for other components' density mixins. Customizations provided by this package is not intended to

0 commit comments

Comments
 (0)