Skip to content

docs(date-input): improve example#439

Open
DavideMininni-Fincons wants to merge 11 commits into
mainfrom
docs/date-input
Open

docs(date-input): improve example#439
DavideMininni-Fincons wants to merge 11 commits into
mainfrom
docs/date-input

Conversation

@DavideMininni-Fincons

Copy link
Copy Markdown
Contributor

Subtask of #358

@github-actions github-actions Bot added the pr: peer review required A peer review is required for this pull request label Jun 24, 2026

@jeripeierSBB jeripeierSBB left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! As a key feature of our form components is Angular form integration, we should in the examples show that. As per our idea, you should create three examples (Template Driven Forms, ReactiveForms and Angular Signal Forms) (Message in Teams some weeks ago). With that it would also be interesting to have e.g. min max or other configuration showed. Just contact me, if you have trouble implementing it :) Know Issue: min max is not fully supported with Signal forms.

@Component({
selector: 'sbb-date-input-reactive-example',
templateUrl: 'date-input-reactive-example.html',
imports: [ReactiveFormsModule, SbbCardModule, SbbDateInput, SbbFormFieldModule],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imports: [ReactiveFormsModule, SbbCardModule, SbbDateInput, SbbFormFieldModule],
imports: [ReactiveFormsModule, SbbCardModule, SbbDateInputModule, SbbFormFieldModule],

@@ -0,0 +1,8 @@
<sbb-form-field>
<label>Date</label>
<sbb-date-input [valueAsDate]="value()" (input)="onInput($event)"></sbb-date-input>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should go via formField

Suggested change
<sbb-date-input [valueAsDate]="value()" (input)="onInput($event)"></sbb-date-input>
<sbb-date-input [formField]="value()"></sbb-date-input>

dateFilter: new FormControl<(d: Date) => boolean>(() => true),
});

onChange(event: Event): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do that via valueChanges or other logic of reactive forms?

],
})
export class DateInputVariantsExample {
protected form = new FormBuilder().group({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you chose reactive forms because of problems with signal forms?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the min/max worked incorrectly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the min max work if you use the reactive validators?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: peer review required A peer review is required for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants