diff --git a/src/demo-app/select/select-demo.html b/src/demo-app/select/select-demo.html
index bb6476d0f200..974b5dc95a53 100644
--- a/src/demo-app/select/select-demo.html
+++ b/src/demo-app/select/select-demo.html
@@ -1,11 +1,30 @@
-
- {{ food.viewValue }}
-
-
Value: {{ control.value }}
-
Touched: {{ control.touched }}
-
Dirty: {{ control.dirty }}
-
Status: {{ control.status }}
-
-
+
+
+ {{ food.viewValue }}
+
+ Value: {{ foodControl.value }}
+ Touched: {{ foodControl.touched }}
+ Dirty: {{ foodControl.dirty }}
+ Status: {{ foodControl.status }}
+
+
+
+
+
+
+
+ {{ drink.viewValue }}
+
+
+ Value: {{ currentDrink }}
+ Touched: {{ drinkControl.touched }}
+ Dirty: {{ drinkControl.dirty }}
+ Status: {{ drinkControl.control?.status }}
+
+
+
+
+
diff --git a/src/demo-app/select/select-demo.scss b/src/demo-app/select/select-demo.scss
index 9c6784bed050..3594a998b107 100644
--- a/src/demo-app/select/select-demo.scss
+++ b/src/demo-app/select/select-demo.scss
@@ -1,2 +1,10 @@
.demo-select {
+ display: flex;
+ flex-flow: row wrap;
+
+ md-card {
+ width: 450px;
+ margin: 24px;
+ }
+
}
\ No newline at end of file
diff --git a/src/demo-app/select/select-demo.ts b/src/demo-app/select/select-demo.ts
index e3cd9f1978b6..f7bec82ca09d 100644
--- a/src/demo-app/select/select-demo.ts
+++ b/src/demo-app/select/select-demo.ts
@@ -9,6 +9,9 @@ import {FormControl} from '@angular/forms';
})
export class SelectDemo {
isRequired = false;
+ isDisabled = false;
+ currentDrink: string;
+ foodControl = new FormControl('');
foods = [
{value: 'steak-0', viewValue: 'Steak'},
@@ -16,6 +19,14 @@ export class SelectDemo {
{value: 'tacos-2', viewValue: 'Tacos'}
];
- control = new FormControl('');
+ drinks = [
+ {value: 'coke-0', viewValue: 'Coke'},
+ {value: 'sprite-1', viewValue: 'Sprite', disabled: true},
+ {value: 'water-2', viewValue: 'Water'}
+ ];
+
+ toggleDisabled() {
+ this.foodControl.enabled ? this.foodControl.disable() : this.foodControl.enable();
+ }
}
diff --git a/src/lib/core/style/_form-common.scss b/src/lib/core/style/_form-common.scss
new file mode 100644
index 000000000000..d7660acaf01b
--- /dev/null
+++ b/src/lib/core/style/_form-common.scss
@@ -0,0 +1,12 @@
+
+// Gradient for showing the dashed line when the input is disabled.
+// Unlike using a border, a gradient allows us to adjust the spacing of the dotted line
+// to match the Material Design spec.
+$md-underline-disabled-background-image:
+ linear-gradient(to right, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0.26) 33%, transparent 0%);
+
+@mixin md-control-disabled-underline {
+ background-image: $md-underline-disabled-background-image;
+ background-size: 4px 1px;
+ background-repeat: repeat-x;
+}
\ No newline at end of file
diff --git a/src/lib/input/input.scss b/src/lib/input/input.scss
index 2ee932341e5d..3d0ef83a9f86 100644
--- a/src/lib/input/input.scss
+++ b/src/lib/input/input.scss
@@ -1,4 +1,5 @@
@import '../core/style/variables';
+@import '../core/style/form-common';
$md-input-floating-placeholder-scale-factor: 0.75 !default;
@@ -149,11 +150,9 @@ md-input, md-textarea {
border-top-style: solid;
&.md-disabled {
+ @include md-control-disabled-underline();
border-top: 0;
- background-image: $md-input-underline-disabled-background-image;
background-position: 0;
- background-size: 4px 1px;
- background-repeat: repeat-x;
}
.md-input-ripple {
diff --git a/src/lib/select/_select-theme.scss b/src/lib/select/_select-theme.scss
index 7e692683d7ff..3cb9960f4f9e 100644
--- a/src/lib/select/_select-theme.scss
+++ b/src/lib/select/_select-theme.scss
@@ -11,12 +11,12 @@
color: md-color($foreground, hint-text);
border-bottom: 1px solid md-color($foreground, divider);
- md-select:focus & {
+ md-select:focus:not(.md-select-disabled) & {
color: md-color($primary);
border-bottom: 1px solid md-color($primary);
}
- .ng-invalid.ng-touched & {
+ .ng-invalid.ng-touched:not(.md-select-disabled) & {
color: md-color($warn);
border-bottom: 1px solid md-color($warn);
}
@@ -25,11 +25,11 @@
.md-select-arrow {
color: md-color($foreground, hint-text);
- md-select:focus & {
+ md-select:focus:not(.md-select-disabled) & {
color: md-color($primary);
}
- .ng-invalid.ng-touched & {
+ .ng-invalid.ng-touched:not(.md-select-disabled) & {
color: md-color($warn);
}
}
@@ -40,10 +40,14 @@
.md-select-value {
color: md-color($foreground, text);
+
+ .md-select-disabled & {
+ color: md-color($foreground, hint-text);
+ }
}
md-option {
- &:hover, &:focus {
+ &:hover:not(.md-option-disabled), &:focus:not(.md-option-disabled) {
background: md-color($background, hover);
}
@@ -52,5 +56,9 @@
color: md-color($primary);
}
+ &.md-option-disabled {
+ color: md-color($foreground, hint-text);
+ }
+
}
}
diff --git a/src/lib/select/option.html b/src/lib/select/option.html
index 4eb163792397..90659d08fbd9 100644
--- a/src/lib/select/option.html
+++ b/src/lib/select/option.html
@@ -1,3 +1,3 @@