Skip to content

Commit

Permalink
Add end-aligned to textfields #818
Browse files Browse the repository at this point in the history
  • Loading branch information
asyncLiz committed Jan 30, 2020
1 parent c0b4e70 commit 2a7b7f5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Added

- End-alignment to `mwc-textfield` and `mwc-textarea`

### Fixed

- Fixed mwc-dialog not removing keydown event listener on close.
Expand Down
6 changes: 6 additions & 0 deletions demos/textarea.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ <h4>Textarea with Helper Text</h4>
<mwc-textarea outlined label="Standard" helper="Helper Text" helperPersistent></mwc-textarea>
</div>

<h4>End-aligned</h4>
<div class="demo-group-spaced">
<mwc-textarea label="Standard" value="End-aligned" endaligned></mwc-textarea>
<mwc-textarea outlined label="Standard" value="End-aligned" endaligned></mwc-textarea>
</div>

<h4>Full Width Textarea</h4>
<mwc-textarea outlined fullwidth label="Standard" helper="Helper Text" helperpersistent></mwc-textarea>
</main>
Expand Down
8 changes: 8 additions & 0 deletions demos/textfield.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ <h4>Text Field with Character Counter</h4>
<mwc-textfield outlined label="Standard" helper="Helper Text" helperPersistent maxlength="18" charCounter></mwc-textfield>
<mwc-textfield outlined label="Standard" helper="Helper Text" helperPersistent maxlength="18" charCounter class="shaped-outlined"></mwc-textfield>
</div>

<h4>End-aligned</h4>
<div class="demo-group-spaced">
<mwc-textfield label="Standard" value="End-aligned" endaligned></mwc-textfield>
<mwc-textfield outlined label="Standard" value="End-aligned" endaligned></mwc-textfield>
<mwc-textfield outlined label="Standard" value="End-aligned" endaligned class="shaped-outlined"></mwc-textfield>
</div>

<h4>Full Width</h4>
<mwc-textfield fullwidth placeholder="Standard" helper="Helper Text" helperpersistent></mwc-textfield>
</main>
Expand Down
1 change: 1 addition & 0 deletions packages/textarea/src/mwc-textarea-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export abstract class TextAreaBase extends TextFieldBase {
'mdc-text-field--no-label': !this.label,
'mdc-text-field--outlined': this.outlined,
'mdc-text-field--fullwidth': this.fullWidth,
'mdc-text-field--end-aligned': this.endAligned,
};

return html`
Expand Down
3 changes: 3 additions & 0 deletions packages/textfield/src/mwc-textfield-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ export abstract class TextFieldBase extends FormElement {

@property({type: Boolean}) charCounter = false;

@property({type: Boolean}) endAligned = false;

@property({type: Boolean}) protected outlineOpen = false;
@property({type: Number}) protected outlineWidth = 0;
@property({type: Boolean}) protected isUiValid = true;
Expand Down Expand Up @@ -222,6 +224,7 @@ export abstract class TextFieldBase extends FormElement {
'mdc-text-field--fullwidth': this.fullWidth,
'mdc-text-field--with-leading-icon': this.icon,
'mdc-text-field--with-trailing-icon': this.iconTrailing,
'mdc-text-field--end-aligned': this.endAligned,
};
return html`
<label class="mdc-text-field ${classMap(classes)}">
Expand Down

0 comments on commit 2a7b7f5

Please sign in to comment.