Skip to content

Commit 92d198b

Browse files
crisbetoandrewseguin
authored andcommitted
fix(input): allow color inputs in mat-form-field (angular#8748)
* Allows users to put an `input[type='color']` inside a form field. * Cleans out a few leftover `floatPlaceholder` usages. Fixes angular#8686.
1 parent 8d79cc8 commit 92d198b

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/demo-app/input/input-demo.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<table style="width: 100%" cellspacing="0"><tr>
1010
<td>
11-
<mat-form-field style="width: 100%" floatPlaceholder="never">
11+
<mat-form-field style="width: 100%" floatLabel="never">
1212
<input matInput placeholder="First name">
1313
</mat-form-field>
1414
</td>
@@ -304,11 +304,18 @@ <h4>Textarea</h4>
304304
</p>
305305

306306
<p>
307-
<mat-form-field [floatPlaceholder]="floatingLabel">
307+
<mat-form-field [floatLabel]="floatingLabel">
308308
<input matInput placeholder="Placeholder">
309309
</mat-form-field>
310310
</p>
311311

312+
<p>
313+
<mat-form-field [floatLabel]="floatingLabel">
314+
<mat-label>What is your favorite color?</mat-label>
315+
<input matInput type="color" value="#00ff00">
316+
</mat-form-field>
317+
</p>
318+
312319
<p>
313320
<mat-form-field>
314321
<input matInput placeholder="Prefixed" value="example">

src/lib/input/input.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {MAT_INPUT_VALUE_ACCESSOR} from './input-value-accessor';
3131
const MAT_INPUT_INVALID_TYPES = [
3232
'button',
3333
'checkbox',
34-
'color',
3534
'file',
3635
'hidden',
3736
'image',

src/universal-app/kitchen-sink/kitchen-sink.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ <h2>Icon</h2>
103103

104104
<h2>Input</h2>
105105

106-
<mat-form-field floatPlaceholder="never">
106+
<mat-form-field floatLabel="never">
107107
<input matInput placeholder="name">
108108
</mat-form-field>
109109

0 commit comments

Comments
 (0)