Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ At the time of writing this README, the `[type]` attribute is copied to the actu

The valid `type` attribute values are any supported by your browser, with the exception of `file`, `checkbox` and `radio`. File inputs aren't supported for now, while check boxes and radio buttons have their own components.

## Text Divider

You can choose to show or hide the text divider line under the `<input>`. By default the text divider will always be `true`.

To hide the text divider:

#### Example

```html
<md-input placeholder="Hiding the text divider" [textDivider]="false">
</md-input>
```


## Prefix and Suffix
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/input.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<div class="md-input-suffix"><ng-content select="[md-suffix]"></ng-content></div>
</div>

<div class="md-input-underline"
<div *ngIf="textDivider" class="md-input-underline"
[class.md-disabled]="disabled">
<span class="md-input-ripple"
[class.md-focused]="focused"
Expand Down
20 changes: 20 additions & 0 deletions src/components/input/input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ export function main() {
expect(typeof fixture.componentInstance.value).toBe('number');
});
});

it('should NOT display text divider under input', () => {
return builder.createAsync(MdInputNoTextDividerTestController)
.then(fixture => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('.md-input-underline'))).toBeFalsy();
});
});
});
}

Expand Down Expand Up @@ -387,3 +395,15 @@ class MdInputAriaTestController {
ariaLabel: string = 'label';
ariaDisabled: boolean = true;
}

@Component({
selector: 'text-input-controller',
template: `
<md-input [textDivider]="false">
</md-input>
`,
directives: [MdInput]
})
class MdInputNoTextDividerTestController {
}

1 change: 1 addition & 0 deletions src/components/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
@Input() @BooleanFieldValue() required: boolean = false;
@Input() @BooleanFieldValue() spellcheck: boolean = false;
@Input() type: string = 'text';
@Input() @BooleanFieldValue() textDivider: boolean = true;

get value(): any { return this._value; };
@Input() set value(v: any) {
Expand Down
10 changes: 10 additions & 0 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
</md-card-content>
</md-card>

<md-card class="demo-card demo-basic">
<md-toolbar color="primary">Text Divider</md-toolbar>
<md-card-content>
<md-input class="demo-full-width" placeholder="Example 1 (with text divider)">
</md-input>
<md-input class="demo-full-width" placeholder="Example 2 (no text divider)" [textDivider]="false">
</md-input>
</md-card-content>
</md-card>

<md-card class="demo-card demo-basic">
<md-toolbar color="primary">Prefix + Suffix</md-toolbar>
<md-card-content>
Expand Down