Skip to content

Commit

Permalink
fix(input): allow color inputs in mat-form-field
Browse files Browse the repository at this point in the history
* Allows users to put an `input[type='color']` inside a form field.
* Cleans out a few leftover `floatPlaceholder` usages.

Fixes #8686.
  • Loading branch information
crisbeto committed Nov 30, 2017
1 parent 27dfd15 commit 18b477f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<table style="width: 100%" cellspacing="0"><tr>
<td>
<mat-form-field style="width: 100%" floatPlaceholder="never">
<mat-form-field style="width: 100%" floatLabel="never">
<input matInput placeholder="First name">
</mat-form-field>
</td>
Expand Down Expand Up @@ -304,11 +304,18 @@ <h4>Textarea</h4>
</p>

<p>
<mat-form-field [floatPlaceholder]="floatingLabel">
<mat-form-field [floatLabel]="floatingLabel">
<input matInput placeholder="Placeholder">
</mat-form-field>
</p>

<p>
<mat-form-field [floatLabel]="floatingLabel">
<mat-label>What is your favorite color?</mat-label>
<input matInput type="color" value="#00ff00">
</mat-form-field>
</p>

<p>
<mat-form-field>
<input matInput placeholder="Prefixed" value="example">
Expand Down
1 change: 0 additions & 1 deletion src/lib/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {MAT_INPUT_VALUE_ACCESSOR} from './input-value-accessor';
const MAT_INPUT_INVALID_TYPES = [
'button',
'checkbox',
'color',
'file',
'hidden',
'image',
Expand Down
2 changes: 1 addition & 1 deletion src/universal-app/kitchen-sink/kitchen-sink.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ <h2>Icon</h2>

<h2>Input</h2>

<mat-form-field floatPlaceholder="never">
<mat-form-field floatLabel="never">
<input matInput placeholder="name">
</mat-form-field>

Expand Down

0 comments on commit 18b477f

Please sign in to comment.