Skip to content

Commit

Permalink
chore(demo): add example with form fieldset (#9368)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 8, 2024
1 parent 822e0a0 commit 96961c7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<fieldset [disabled]="disable()">
<legend>Payment fieldset</legend>

<tui-textfield
iconStart="@tui.credit-card"
tuiTextfieldSize="s"
>
<label tuiLabel>Card number</label>
<input
tuiTextfield
[(ngModel)]="card"
/>
</tui-textfield>

<tui-textfield
iconStart="@tui.user"
tuiTextfieldSize="s"
>
<label tuiLabel>Card holder</label>
<input
tuiTextfield
[(ngModel)]="name"
/>
</tui-textfield>
</fieldset>

<label class="t-label">
<input
size="s"
tuiSwitch
type="checkbox"
[ngModel]="disable()"
(ngModelChange)="disable.set($event)"
/>
Disable
</label>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fieldset {
display: flex;
flex-direction: column;
gap: 1rem;
}

.t-label {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.25rem;
inline-size: fit-content;
cursor: pointer;
}
20 changes: 20 additions & 0 deletions projects/demo/src/modules/components/textfield/examples/6/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {Component, signal} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiTextfield} from '@taiga-ui/core';
import {TuiSwitch} from '@taiga-ui/kit';

@Component({
standalone: true,
imports: [FormsModule, TuiSwitch, TuiTextfield],
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
export default class Example {
protected readonly disable = signal(true);
protected card = '1111 1111 1111 1111';
protected name = 'Test User';
}
1 change: 1 addition & 0 deletions projects/demo/src/modules/components/textfield/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default class Page {
'Dropdown',
'Interactive icons',
'Mask',
'Fieldset',
];

protected value = '';
Expand Down

0 comments on commit 96961c7

Please sign in to comment.