-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:form): support form label align (#7870)
- Loading branch information
1 parent
3dfa655
commit d54b3b4
Showing
7 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 15 | ||
title: | ||
zh-CN: 表单标签文本对齐方式 | ||
en-US: Text align of form label | ||
--- | ||
|
||
## zh-CN | ||
|
||
表单标签文本对齐方式。 | ||
|
||
## en-US | ||
|
||
text align of form label. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-form-label-align', | ||
template: ` | ||
<form nz-form [formGroup]="validateForm"> | ||
<nz-form-item> | ||
<nz-form-label nzRequired nzLabelAlign="left" nzSpan="4">Left-aligned text label</nz-form-label> | ||
<nz-form-control nzErrorTip="Please input your username!" nzSpan="8"> | ||
<input formControlName="userName" nz-input placeholder="Username" /> | ||
</nz-form-control> | ||
</nz-form-item> | ||
<nz-form-item> | ||
<nz-form-label nzRequired nzLabelAlign="right" nzSpan="4">Right-aligned text label</nz-form-label> | ||
<nz-form-control nzErrorTip="Please input your Password!" nzSpan="8"> | ||
<input formControlName="password" nz-input type="password" placeholder="Password" /> | ||
</nz-form-control> | ||
</nz-form-item> | ||
</form> | ||
` | ||
}) | ||
export class NzDemoFormLabelAlignComponent implements OnInit { | ||
validateForm!: UntypedFormGroup; | ||
|
||
submitForm(): void { | ||
console.log('submit', this.validateForm.value); | ||
} | ||
|
||
constructor(private fb: UntypedFormBuilder) {} | ||
|
||
ngOnInit(): void { | ||
this.validateForm = this.fb.group({ | ||
userName: [null, [Validators.required]], | ||
password: [null, [Validators.required]], | ||
remember: [true] | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters