Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Placeholder to GoSelect Documentation #252

Merged
merged 1 commit into from
Oct 7, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,38 @@ <h2 class="go-heading-6 go-heading--underlined">Code</h2>
</div>
</ng-container>
</go-card>
<go-card id="form-select-placeholder" class="go-column go-column--100">
<ng-container go-card-header>
<h1 class="go-heading-5">Component Placeholder</h1>
</ng-container>
<ng-container go-card-content>
<p class="go-body-copy">
Sometimes we may want to be able to add a placeholder for the select box. We can achieve this through the
<code class="code-block--inline">@Input() placeholder: string;</code> binding. Setting
<code class="code-block--inline">placeholder</code> to a string will display that string by default in the
select box. When you select an option in the select box, it will replace the placeholder with the selected item.
</p>
<div class="go-container">
<div class="go-column go-column--50">
<h2 class="go-heading-6 go-heading--underlined">View</h2>
<go-select
bindLabel="name"
bindValue="value"
[control]="select8"
[items]="items"
[multiple]="true"
placeholder="Select a Candy"
label="Favorite Candy"
></go-select>
</div>
<div class="go-column go-column--50">
<h2 class="go-heading-6 go-heading--underlined">Code</h2>
<code
[highlight]="select8Code"
class="code-block--no-bottom-margin"
></code>
</div>
</div>
</ng-container>
</go-card>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class SelectDocsComponent implements OnInit {
select5: FormControl = new FormControl('');
select6: FormControl = new FormControl('');
select7: FormControl = new FormControl('');
select8: FormControl = new FormControl('');

hints: Array<string> = ['please select you favorite candy'];

Expand Down Expand Up @@ -105,6 +106,18 @@ export class SelectDocsComponent implements OnInit {
></go-select>
`;

select8Code: string = `
<go-select
bindLabel="name"
bindValue="value"
[control]="select"
[items]="items"
[multiple]="true"
placeholder="Select a Candy"
label="Favorite Candy"
></go-select>
`;

ngOnInit(): void {
setTimeout((): void => {
this.select5.setErrors([
Expand Down