-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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`. | ||
|
||
|
||
<!-- 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. | ||
In this mode, the `value` of the `md-button-toggle-group` will reflect the value of the selected | ||
button and `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-button-toggle-group` does not have a value, | ||
and `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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`, makes the button close the dialog on click| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
radio-button-group (also surround with backticks)
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 wanted to refer to the general idea of a radio-button group vs.
md-radio-group
specifically.