-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: initial overview docs for button - dialog #2290
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Buttons toggles aregroups of buttons that can be toggled on and off. They can be configured to | ||
behave as checkboxes or as radio buttons. Button toggles are always part of a | ||
`md-button-toggle-group`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is true, you could have a single button that can toggle on or off. The code says the toggle group is optional: https://github.com/angular/material2/blob/master/src/lib/button-toggle/button-toggle.ts#L299 |
||
|
||
<!-- example(button-toggle-overview) --> | ||
|
||
### Exclusive selection vs. multiple selection | ||
By default, `md-button-toggle-group` acts like a radio-button group- only one item can be selected. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. radio-button-group (also surround with backticks) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to refer to the general idea of a radio-button group vs. |
||
In this mode, the `value` of the `md-radio-group` will reflect the value of the selected button and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. md-button-toggle-group? |
||
`ngModel` is supported. | ||
|
||
Adding the `multiple` attribute allows multiple items to be selected (checkbox behavior). In this | ||
mode the values of the the toggles are not used, the `md-radio-group` does not have a value, and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. md-button-toggle-group |
||
`ngModel` is not supported. | ||
|
||
### Accessibility | ||
The button-toggles will present themselves as either checkboxes or radio-buttons based on the | ||
presence of the `multiple` attribute. | ||
|
||
### Orientation | ||
The button-toggles can be rendered in a vertical orientation by adding the `vertical` attribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Angular Material buttons are native `<button>` or `<a>` elements enhanced with Material Design | ||
styling and ink ripples. | ||
|
||
<!-- example(button-overview) --> | ||
|
||
Native `<button>` and `<a>` elements are always used in order to provide the most straightforward | ||
and accessible experience for users. A `<button>` element should be used whenever some _action_ | ||
is performed. An `<a>` element should be used whenever the user will _navigate_ to another view. | ||
|
||
|
||
There are five button variants, each applied as an attribute: | ||
|
||
| Attribute | Description | | ||
|--------------------|-----------------------------------------------------------------------------| | ||
| `md-button` | Rectangular button w/ no elevation. | | ||
| `md-raised-button` | Rectangular button w/ elevation | | ||
| `md-icon-button` | Circular button with a transparent background, meant to contain an icon | | ||
| `md-fab` | Circular button w/ elevation, defaults to theme's accent color | | ||
| `md-mini-fab` | Same as `md-fab` but smaller | | ||
|
||
|
||
### Theming | ||
Buttons can be colored in terms of the current theme using the `color` property to set the | ||
background color to `primary`, `accent`, or `warn`. By default, only FABs are colored; the default | ||
background color for `md-button` and `md-raised-button` matches the theme's background color. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Cards are content containers for text, photos, and actions. Cards are intended to provide | ||
information on a single subject. | ||
|
||
<!-- example(card-overview) --> | ||
|
||
|
||
### Basic card sections | ||
The most basic card needs only an `<md-card>` element with some content. However, Angular Material | ||
provides a number of preset sections that you can use inside of an `<md-card>`: | ||
|
||
|
||
| Element | Description | | ||
|-----------------------|--------------------------------------------------------------------------| | ||
| `<md-card-title>` | Card title | | ||
| `<md-card-subtitle>` | Card subtitle | | ||
| `<md-card-content>` | Primary card content. Intended for blocks of text | | ||
| `<img md-card-image>` | Card image. Stretches the image to the container width | | ||
| `<md-card-actions>` | Container for buttons at the bottom of the card | | ||
| `<md-card-footer>` | Section anchored to the bottom of the card | | ||
|
||
These elements primary serve as pre-styled content containers without any additional APIs. | ||
However, the `align` property on `<md-card-actions>` can be used to position the actions at the | ||
`'start'` or `'end` of the container. | ||
|
||
|
||
### Card headers | ||
In addition to the aforementioned sections, `<md-card-header>` gives the ability to add a rich | ||
header to a card. This header can contain: | ||
|
||
| Element | Description | | ||
|------------------------|-------------------------------------------------------------------------| | ||
| `<md-card-title>` | A title within the header | | ||
| `<md-card-subtitle>` | A subtitle within the header | | ||
| `<img md-card-avatar>` | An image used as an avatar within the header | | ||
|
||
|
||
### Title groups | ||
An `<md-title-group>` can be used to combine a title, subtitle, and image into a single section. | ||
This element can contain: | ||
* `<md-card-title>` | ||
* `<md-card-subtite>` | ||
* One of: | ||
* `<img md-card-sm-image>` | ||
* `<img md-card-md-image>` | ||
* `<img md-card-lg-image>` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
`<md-checkbox>` provides the same functionality as a native `<input type="checkbox">` | ||
enhanced Material Design styling and animations. | ||
|
||
<!-- example(checkbox-overview) --> | ||
|
||
### Checkbox label | ||
The checkbox label is provided as the content to the `<md-checkbox>` element. The label can be | ||
positioned before or after the checkbox by setting the `labelPosition` property to `'before'` or | ||
`'after'`. | ||
|
||
If you don't want the label to appear next to the checkbox, 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. | ||
|
||
### Use with `@angular/forms` | ||
`<md-checkobx>` is compatible with `@angular/forms` and supports both `FormsModule` | ||
and `ReactiveFormsModule`. | ||
|
||
### Indeterminate state | ||
`<md-checkbox>` supports an `indeterminate` state, similar to the native `<input type="checkbox">`. | ||
While the `indeterminate` property of the checkbox is true, it will render as indeterminate | ||
regardless of the `checked` value. Any interaction with the checkbox by a user (i.e., clicking) will | ||
remove the indeterminate state. | ||
|
||
### Theming | ||
The color of a `<md-checkbox>` can be changed by using the `color` property. By default, checkboxes | ||
use the theme's accent color. This can be changed to `'primary'` or `'warn'`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
The `MdDialog` service can be used to open modal dialogs with Material Design styling and | ||
animations. | ||
|
||
<!-- example(dialog-overview) --> | ||
|
||
A dialog is opened by calling the `open` method with a component to be loaded and an optional | ||
config object. The `open` method will return an instance of `MdDialogRef`: | ||
|
||
```ts | ||
let dialogRef = dialog.open(UserProfileComponent, { | ||
height: '400px', | ||
width: '600px', | ||
}); | ||
``` | ||
|
||
The `MdDialogRef` provides a handle on the opened dialog. It can be used to close the dialog and to | ||
recieve notification when the dialog has been closed. | ||
```ts | ||
dialogRef.afterClosed.then(result => { | ||
console.log(`Dialog result: ${result}`); // Pizza! | ||
}); | ||
|
||
dialogRef.close('Pizza!'); | ||
|
||
``` | ||
|
||
Components created via `MdDialog` can _inject_ `MdDialogRef` and use it to close the dialog | ||
in which they are contained. When closing, an optional result value can be provided. This result | ||
value is forwarded as the result of the `afterClosed` promise. | ||
|
||
### Dialog content | ||
Several directives are available to make it easier to structure your dialog content: | ||
|
||
| Name | Description | | ||
|-----------------------|--------------------------------------------------------------------------| | ||
| `md-dialog-title` | \[Attr] Dialog title, applied to a heading element (e.g., `<h1>`, `<h2>`)| | ||
| `<md-dialog-content>` | Primary scrollable content of the dialog | | ||
| `<md-dialog-actions>` | Container for action buttons at the bottom of the dialog | | ||
| `md-dialog-close` | \[Attr] Added to a `<button>` to make the button close the on click | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You missed "dialog" here - "...to make the button close the dialog on click". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button toggles are groups...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think "buttons toggles" is a weird way to pluralize it, it also says "button toggles" elsewhere in this same readme