diff --git a/src/demo-app/chips/chips-demo.html b/src/demo-app/chips/chips-demo.html index d3ba62b3824..086903316ac 100644 --- a/src/demo-app/chips/chips-demo.html +++ b/src/demo-app/chips/chips-demo.html @@ -62,4 +62,4 @@ - \ No newline at end of file + diff --git a/src/lib/button-toggle/OVERVIEW.md b/src/lib/button-toggle/OVERVIEW.md index 5bd6507c7ac..39e50322031 100644 --- a/src/lib/button-toggle/OVERVIEW.md +++ b/src/lib/button-toggle/OVERVIEW.md @@ -1,6 +1,6 @@ -Button-toggles are on/off toggles with the appearance of a button. These toggles can be configured -to behave as either radio-buttons or checkboxes. While they can be standalone, they are typically -part of a `md-button-toggle-group`. +`` are on/off toggles with the appearance of a button. These toggles can be +configured to behave as either radio-buttons or checkboxes. While they can be standalone, they are +typically part of a `md-button-toggle-group`. diff --git a/src/lib/card/OVERVIEW.md b/src/lib/card/OVERVIEW.md index 81afbdb9c92..70c78a257e0 100644 --- a/src/lib/card/OVERVIEW.md +++ b/src/lib/card/OVERVIEW.md @@ -1,4 +1,4 @@ -Cards are content containers for text, photos, and actions. Cards are intended to provide +`` is a content container for text, photos, and actions. Cards are intended to provide information on a single subject. diff --git a/src/lib/checkbox/OVERVIEW.md b/src/lib/checkbox/OVERVIEW.md index 5512e816bce..250467ed073 100644 --- a/src/lib/checkbox/OVERVIEW.md +++ b/src/lib/checkbox/OVERVIEW.md @@ -1,5 +1,5 @@ `` provides the same functionality as a native `` -enhanced Material Design styling and animations. +enhanced with Material Design styling and animations. diff --git a/src/lib/chips/OVERVIEW.md b/src/lib/chips/OVERVIEW.md new file mode 100644 index 00000000000..33caeb0c989 --- /dev/null +++ b/src/lib/chips/OVERVIEW.md @@ -0,0 +1,30 @@ +`` displays a list of values as individual chips. + + + +_Note: chips are still early in their development and more features are being actively worked on._ + +```html + + Papadum + Naan + Dal + +``` + +### Unstyled chips +By default, `` has Material Design styles applied. For a chip with no styles applied, +use ``. You can then customize the chip appearance by adding your own CSS. + +### Selection +Chips can be selected via the `selected` property. Selection can be disabled by setting +`selectable` to `false` on the ``. + +### Keyboard interation +Users can move through the chips using the arrow keys and select them with the space. + + +### Theming +The color of an `` can be changed by using the `color` property. By default, chips +use a neutral background color based on the current theme (light or dark). This can be changed to +`'primary'`, `'accent'`, or `'warn'`. diff --git a/src/lib/grid-list/OVERVIEW.md b/src/lib/grid-list/OVERVIEW.md index ef22f95d8f4..3f30d0078d3 100644 --- a/src/lib/grid-list/OVERVIEW.md +++ b/src/lib/grid-list/OVERVIEW.md @@ -1,12 +1,8 @@ -# md-grid-list - -`md-grid-list` is an alternative list view that arranges cells into grid-based layout. +`md-grid-list` is a two-dimensional list view that arranges cells into grid-based layout. See Material Design spec [here](https://www.google.com/design/spec/components/grid-lists.html). -## Usage - ### Setting the number of columns An `md-grid-list` must specify a `cols` attribute which sets the number of columns in the gird. The diff --git a/src/lib/icon/OVERVIEW.md b/src/lib/icon/OVERVIEW.md index e99edd5f9f0..1d33c7793fb 100644 --- a/src/lib/icon/OVERVIEW.md +++ b/src/lib/icon/OVERVIEW.md @@ -1,23 +1,14 @@ -# md-icon - `md-icon` makes it easier to use _vector-based_ icons in your app. This directive supports both icon fonts and SVG icons, but not bitmap-based formats (png, jpg, etc.). -## Usage - -### Registering new icons +### Registering icons `MdIconRegistry` is an injectable service that allows you to associate icon names with SVG URLs and define aliases for CSS font classes. Its methods are discussed below and listed in the API summary. -In order to prevent XSS vulnerabilities, any URLs passed to the `MdIconRegistry` must be marked as -trusted resource URLs by using Angular's `DomSanitizer` service. - -### Font icons - -#### Ligatures +### Font icons with ligatures Some fonts are designed to show icons by using [ligatures](https://en.wikipedia.org/wiki/Typographic_ligature), for example by rendering the text @@ -31,7 +22,7 @@ You can specify a different font by setting the `fontSet` input to either the CS use the desired font, or to an alias previously registered with `MdIconRegistry.registerFontClassAlias`. -#### Font icons via CSS +### Font icons with CSS Fonts can also display icons by defining a CSS class for each icon glyph, which typically uses a `:before` selector to cause the icon to appear. @@ -48,14 +39,17 @@ explicitly set by calling `MdIconRegistry.setDefaultFontSetClass`. When an `md-icon` component displays an SVG icon, it does so by directly inlining the SVG content into the page as a child of the component. (Rather than using an tag or a div background image). This makes it easier to apply CSS styles to SVG icons. For example, the default color of the -SVG content is the CSS [currentColor](http://www.quirksmode.org/css/color/currentcolor.html) value. -This makes SVG icons by default have the same color as surrounding text, and allows you to change -the color by setting the "color" style on the `md-icon` element. +SVG content is the CSS +[currentColor](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentColor_keyword) +value. This makes SVG icons by default have the same color as surrounding text, and allows you to +change the color by setting the "color" style on the `md-icon` element. -#### Icons from URLs +In order to prevent XSS vulnerabilities, any SVG URLs passed to the `MdIconRegistry` must be +marked as trusted resource URLs by using Angular's `DomSanitizer` service. -SVG icons can be used either by directly specifying the icon's URL, or by associating an icon name -with a URL and then referring to the name. To use a URL directly, set the `svgSrc` input. +Also note that all SVG icons are fetched via XmlHttpRequest, and due to the same-origin policy, +their URLs must be on the same domain as the containing page, or their servers must be configured +to allow cross-domain access. #### Named icons @@ -78,14 +72,11 @@ as for individually registered icons. Multiple icon sets can be registered in the same namespace. Requesting an icon whose id appears in more than one icon set, the icon from the most recently registered set will be used. -Note that all SVG icons are fetched via XmlHttpRequest, and due to the same-origin policy their URLs -must be on the same domain as the containing page, or their servers must be configured to allow -cross-domain access. - ### Theming -Icons can be themed to match your "primary" palette, your "accent" palette, or your "warn" palette -using the `color` attribute. Simply pass in the desired palette name. +By default, icons will use the current font color (`currentColor`). this color can be changed to +match the current theme's colors using the `color` attribute. This can be changed to +`'primary'`, `'accent'`, or `'warn'`. ### Accessibility diff --git a/src/lib/input/OVERVIEW.md b/src/lib/input/OVERVIEW.md index 26fc7de62fe..680cb524ed9 100644 --- a/src/lib/input/OVERVIEW.md +++ b/src/lib/input/OVERVIEW.md @@ -1,29 +1,25 @@ -# md-input-container +`` is a wrapper for native `input` and `textarea` elements. This container +applies Material Design styles and behavior while still allowing direct access to the underlying +native element. -Inputs are the basic input component of Material 2. The spec can be found -[here](https://www.google.com/design/spec/components/text-fields.html). `md-input-container` acts as -a wrapper for native `input` and `textarea` elements that is used to add material design styles and -behavior. The native element wrapped by the `md-input-container` must be marked with the `md-input` -directive. +The native element wrapped by the `md-input-container` must be marked with the `mdInput` directive. -## Usage - ### `input` and `textarea` attributes All of the attributes that can be used with normal `input` and `textarea` elements can be used on -elements within the `md-input-container` as well. This includes angular specific ones such as +elements inside `md-input-container` as well. This includes Angular directives such as `ngModel` and `formControl`. The only limitations are that the `type` attribute can only be one of the values supported by `md-input-container` and the native element cannot specify a `placeholder` attribute if the `md-input-container` also contains a `md-placeholder` element. -#### Supported `input` types +### Supported `input` types -The following [input types](http://www.w3schools.com/TAGs/att_input_type.asp) can be used with -`md-input-container`: +The following [input types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) can +be used with `md-input-container`: * date * datetime-local * email diff --git a/src/lib/list/OVERVIEW.md b/src/lib/list/OVERVIEW.md new file mode 100644 index 00000000000..8365e1b63c3 --- /dev/null +++ b/src/lib/list/OVERVIEW.md @@ -0,0 +1,124 @@ +`` is a container component that wraps and formats a series of line items. As the base +list component, it provides Material Design styling, but no behavior of its own. + + + + +### Simple lists + +An `` element contains a number of `` elements. + +```html + + Pepper + Salt + Paprika + +``` + +### Navigation lists + +Use `md-nav-list` tags for navigation lists (i.e. lists that have anchor tags). + +Simple navigation lists can use the `md-list-item` attribute on anchor tag elements directly: + +```html + + {{ link }} + +``` + +For more complex navigation lists (e.g. with more than one target per item), wrap the anchor +element in an ``. + +```html + + + {{ link }} + + + +``` + +### Multi-line lists +For lists that require multiple lines per item, annotate each line with an `md-line` attribute. +Whichever heading tag is appropriate for your DOM hierarchy should be used (not necesarily `

` +as shown in the example). + +```html + + + +

{{message.from}}

+

+ {{message.subject}} + -- {{message.content}} +

+
+
+ + + + +

{{message.from}}

+

{{message.subject}}

+

{{message.content}}

+
+
+``` + +### Lists with avatars +To include an avatar, add an image tag with an `md-list-avatar` attribute. + +```html + + + ... +

{{message.from}}

+

+ {{message.subject}} + -- {{message.content}} +

+
+
+``` + +### Dense lists +Lists are also available in "dense layout" mode, which shrinks the font size and height of the list +to suit UIs that may need to display more information. To enable this mode, add a `dense` attribute +to the main `md-list` tag. + + +```html + + Pepper + Salt + Paprika + +``` + + +### Lists with multiple sections + +Subheader can be added to a list by annotating a heading tag with an `md-subheader` attribute. +To add a divider, use ``. + +```html + +

Folders

+ + folder +

{{folder.name}}

+

{{folder.updated}}

+
+ +

Notes

+ + note +

{{note.name}}

+

{{note.updated}}

+
+
+``` diff --git a/src/lib/menu/OVERVIEW.md b/src/lib/menu/OVERVIEW.md new file mode 100644 index 00000000000..44650a524bb --- /dev/null +++ b/src/lib/menu/OVERVIEW.md @@ -0,0 +1,62 @@ +`` is a floating panel containing list of options. + + + +By itself, the `` element does not render anything. The menu is attached to and opened +via application of the `mdMenuTriggerFor` directive: +```ts + + + + + + +``` + +### Toggling the menu programmatically +The menu exposes an API to open/close programmatically. Please note that in this case, an +`mdMenuTriggerFor` directive is still necessary to attach the menu to a trigger element in the DOM. + +```ts +class MyComponent { + @ViewChild(MdMenuTrigger) trigger: MdMenuTrigger; + + someMethod() { + this.trigger.openMenu(); + } +} +``` + +### Icons +Menus support displaying `md-icon` elements before the menu item text. + +*my-comp.html* +```html + + + + + +``` + +### Customizing menu position + +By default, the menu will display after and below its trigger. The position can be changed +using the `x-position` (`before | after`) and `y-position` (`above | below`) attributes. + + +### Keyboard interaction +- DOWN_ARROW: Focuses the next menu item +- UP_ARROW: Focuses previous menu item +- ENTER: Activates the focused menu item diff --git a/src/lib/progress-bar/OVERVIEW.md b/src/lib/progress-bar/OVERVIEW.md new file mode 100644 index 00000000000..b2fbf54d63b --- /dev/null +++ b/src/lib/progress-bar/OVERVIEW.md @@ -0,0 +1,30 @@ +`` is a horizontal progress-bar for indicating progress and activity. + + + + +### Progress mode +The progress-bar supports four modes. + +| Mode | Description | +|---------------|----------------------------------------------------------------------------------| +| determinate | Standard progress bar, fills from 0% to 100% | +| indeterminate | Indicates that something is happening without conveying a discrete progress | +| buffer | Dual-progress mode, typically showing both video download and playback progress | +| query | Dual-stage mode, typically showing sending a request and downloading a response | + +The default mode is "determinate". In this mode, the progress is set via the `value` property, +which can be a whole number between 0 and 100. + +In "buffer" mode, `value` determines the progress of the primary bar while the `bufferValue` is +used to show the additional buffering progress. + +In "query" mode, the progress-bar renders as an inverted "indeterminate" bar. Once the response +progress is available, the `mode` should be changed to determinate to convey the progress. + +In both "indeterminate" and "query" modes, the `value` property is ignored. + + +### Theming +The color of a progress-bar can be changed by using the `color` property. By default, progress-bars +use the theme's primary color. This can be changed to `'accent'` or `'warn'`. diff --git a/src/lib/progress-spinner/OVERVIEW.md b/src/lib/progress-spinner/OVERVIEW.md new file mode 100644 index 00000000000..b9b2adf724e --- /dev/null +++ b/src/lib/progress-spinner/OVERVIEW.md @@ -0,0 +1,23 @@ +`` and `` are a circular indicators of progress and activity. + + + +### Progress mode +The progress-spinner supports two modes, "determinate" and "indeterminate". +The `` component is an alias for ``. + +| Mode | Description | +|---------------|----------------------------------------------------------------------------------| +| determinate | Standard progress indicator, fills from 0% to 100% | +| indeterminate | Indicates that something is happening without conveying a discrete progress | + + +The default mode is "determinate". In this mode, the progress is set via the `value` property, +which can be a whole number between 0 and 100. + +In "indeterminate" mode, the `value` property is ignored. + + +### Theming +The color of a progress-spinner can be changed by using the `color` property. By default, +progress-spinners use the theme's primary color. This can be changed to `'accent'` or `'warn'`. diff --git a/src/lib/radio/OVERVIEW.md b/src/lib/radio/OVERVIEW.md new file mode 100644 index 00000000000..776f7c758a0 --- /dev/null +++ b/src/lib/radio/OVERVIEW.md @@ -0,0 +1,29 @@ +`` provides the same functionality as a native `` enhanced with +Material Design styling and animations. + + + +All radio buttons with the same `name` comprise a set from which only one may be selected at a time. + +### Radio-button label +The radio-button label is provided as the content to the `` element. The label can be +positioned before or after the radio-button by setting the `labelPosition` property to `'before'` +or `'after'`. + +If you don't want the label to appear next to the radio-button, you can use +[`aria-label`](https://www.w3.org/TR/wai-aria/states_and_properties#aria-label) or +[`aria-labelledby`](https://www.w3.org/TR/wai-aria/states_and_properties#aria-labelledby) to +specify an appropriate label. + + +### Radio groups +Radio-buttons should typically be placed inside of an `` unless the DOM structure +would make that impossible (e.g., radio buttons inside of table cells). The radio-group has a +`value` property that reflects the currently selected radio-button inside of the group. + +Individual radio-buttons inside of a radio-group will inherit the `name` of the group. + + +### Use with `@angular/forms` +`` is compatible with `@angular/forms` and supports both `FormsModule` +and `ReactiveFormsModule`. diff --git a/src/lib/select/OVERVIEW.md b/src/lib/select/OVERVIEW.md new file mode 100644 index 00000000000..27aee5f25dd --- /dev/null +++ b/src/lib/select/OVERVIEW.md @@ -0,0 +1,8 @@ +`` is a form control for selecting a value from a set of options, similar to the native +``. + + + +_Note: the sliding behavior for this component requires that HammerJS is loaded on the page._ + +### Selecting a value + +By default the minimum value of the slider is `0`, the maximum value is `100`, and the thumb moves +in increments of `1`. These values can be changed by setting the `min`, `max`, and `step` attributes +respectively. The initial value is set to the minimum value unless otherwise specified. + +```html + +``` + +### Orientation + +By default sliders are horizontal with the minimum value on the left and the maximum value on the +right. The `vertical` attribute can be added to a slider to make it vertical with the minimum value +on bottom and the maximum value on top. + +```html + +``` + +An `invert` attribute is also available which can be specified to flip the axis that the thumb moves +along. An inverted horizontal slider will have the minimum value on the right and the maximum value +on the left, while an inverted vertical slider will have the minimum value on top and the maximum +value on bottom. + +```html + +``` + +### Thumb label +By default, the exact selected value of a slider is not visible to the user. However, this value can +be added to the thumb by adding the `thumbLabel` attribute. + +The [Material Design spec](https://material.google.com/components/sliders.html) recommends using the +`thumbLabel` attribute (along with `tickInterval="1"`) only for sliders that are used to display a +discrete value (such as a 1-5 rating). + +```html + +``` + +### Tick marks +By default, sliders do not show tick marks along the thumb track. This can be enabled using the +`tickInterval` attribute. The value of `tickInterval` should be a number representing the number +of steps between between ticks. For example a `tickInterval` of `3` with a `step` of `4` will draw +tick marks at every `3` steps, which is the same as every `12` values. + +```html + +``` + +The `tickInterval` can also be set to `auto` which will automatically choose the number of steps +such that there is at least `30px` of space between ticks. + +```html + +``` + +The slider will always show a tick at the beginning and end of the track. If the remaining space +doesn't add up perfectly the last interval will be shortened or lengthened so that the tick can be +shown at the end of the track. + +The [Material Design spec](https://material.google.com/components/sliders.html) recommends using the +`tickInterval` attribute (set to `1` along with the `thumbLabel` attribute) only for sliders that +are used to display a discrete value (such as a 1-5 rating). + + +### Keyboard interaction +The slider has the following keyboard bindings: + +| Key | Action | +|-------------|------------------------------------------------------------------------------------| +| Right arrow | Increment the slider value by one step (decrements in RTL). | +| Up arrow | Increment the slider value by one step. | +| Left arrow | Decrement the slider value by one step (decrements in RTL). | +| Down arrow | Decrement the slider value by one step. | +| Page up | Increment the slider value by 10 steps. | +| Page down | Decrement the slider value by 10 steps. | +| End | Set the value to the maximum possible. | +| Home | Set the value to the minimum possible. | diff --git a/src/lib/snack-bar/OVERVIEW.md b/src/lib/snack-bar/OVERVIEW.md new file mode 100644 index 00000000000..a11271f14f5 --- /dev/null +++ b/src/lib/snack-bar/OVERVIEW.md @@ -0,0 +1,47 @@ +`MdSnackBar` is a service for displaying snack-bar notifications. + + + +### Opening a snack-bar +A snack-bar can contain either a string message or a given component. +```ts +// Simple message. +let snackBarRef = snackBar.open('Message archived'); + +// Simple message with an action. +let snackBarRef = snackBar.open('Message archived', 'Undo'); + +// Load the given component into the snack-bar. +let snackBarRef = snackbar.openFromComponent(MessageArchivedComponent); +``` + +In either case, an `MdSnackBarRef` is returned. This can be used to dismiss the snack-bar or to +recieve notification of when the snack-bar is dismissed. For simple messages with an action, the +`MdSnackBarRef` exposes an observable for when the action is triggered. + +```ts +snackBarRef.afterDismissed().subscribe(() => { + console.log('The snack-bar was dismissed'); +}); + + +snackBarRef.onAction().subscribe(() => { + console.log('The snack-bar action was triggered!'); +}); + +snackBarRef.dismiss(); +``` + +### Dismissal +A snack-bar can be dismissed manually by calling the `dismiss` method on the `MdSnackBarRef` +returned from the call to `open`. + +Only one snack-bar can ever be opened at one time. If a new snackbar is opened while a previous +message is still showing, the older message will be automatically dismissed. + +A snack-bar can also be given a duration via the optional configuration object: +```ts +snackbar.open('Message archived', 'Undo', { + duration: 3000 +}); +``` diff --git a/src/lib/tabs/OVERVIEW.md b/src/lib/tabs/OVERVIEW.md index 18c670d76c4..fdc34b13e10 100644 --- a/src/lib/tabs/OVERVIEW.md +++ b/src/lib/tabs/OVERVIEW.md @@ -1,4 +1,4 @@ -The Angular Material tab group helps organize content into separate views where only one view can be +Angular Material tabs organize content into separate views where only one view can be visible at a time. Each tab's label is shown in the tab header and the active tab's label is designated with the animated ink bar. When the list of tab labels exceeds the width of the header, pagination controls appear to let the user scroll left and right across the labels. @@ -57,4 +57,25 @@ For more complex labels, add a template with the `md-tab-label` directive inside By default, the tab group will not change its height to the height of the currently active tab. To change this, set the `dynamicHeight` input to true. The tab body will animate its height according - to the height of the active tab. \ No newline at end of file + to the height of the active tab. + +### Tabs and navigation +While `` is used to switch between views within a single route, `