+ Block
+ is a special presentation of a checkbox/radiobutton which can display actual control or be a control itself
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add an import:
+
+
+
+
+
+
Add to the template:
+
+
+
+
+
+
diff --git a/projects/demo/src/modules/components/block/examples/1/index.html b/projects/demo/src/modules/components/block/examples/1/index.html
new file mode 100644
index 000000000000..a67ce18d3489
--- /dev/null
+++ b/projects/demo/src/modules/components/block/examples/1/index.html
@@ -0,0 +1,37 @@
+
diff --git a/projects/demo/src/modules/components/block/examples/1/index.less b/projects/demo/src/modules/components/block/examples/1/index.less
new file mode 100644
index 000000000000..a074a4106e19
--- /dev/null
+++ b/projects/demo/src/modules/components/block/examples/1/index.less
@@ -0,0 +1,6 @@
+form {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 1rem;
+}
diff --git a/projects/demo/src/modules/components/radio-block/examples/3/index.ts b/projects/demo/src/modules/components/block/examples/1/index.ts
similarity index 57%
rename from projects/demo/src/modules/components/radio-block/examples/3/index.ts
rename to projects/demo/src/modules/components/block/examples/1/index.ts
index 07cba3bf67f2..4a8d45dff07e 100644
--- a/projects/demo/src/modules/components/radio-block/examples/3/index.ts
+++ b/projects/demo/src/modules/components/block/examples/1/index.ts
@@ -4,14 +4,17 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
@Component({
- selector: 'tui-radio-block-example-3',
+ selector: 'tui-block-example-1',
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
-export class TuiRadioBlockExample3 {
+export class TuiBlockExample1 {
protected readonly testForm = new FormGroup({
- testValue: new FormControl('example1'),
+ testValue1: new FormControl(true),
+ testValue2: new FormControl({value: false, disabled: true}),
+ testValue3: new FormControl({value: true, disabled: true}),
+ testValue4: new FormControl(false),
});
}
diff --git a/projects/demo/src/modules/components/block/examples/2/index.html b/projects/demo/src/modules/components/block/examples/2/index.html
new file mode 100644
index 000000000000..6fb8268d2e5f
--- /dev/null
+++ b/projects/demo/src/modules/components/block/examples/2/index.html
@@ -0,0 +1,115 @@
+
Horizontal group
+
+
Vertical group
+
+
Without checkbox indicators
+
diff --git a/projects/demo/src/modules/components/checkbox-block/examples/2/index.less b/projects/demo/src/modules/components/block/examples/2/index.less
similarity index 100%
rename from projects/demo/src/modules/components/checkbox-block/examples/2/index.less
rename to projects/demo/src/modules/components/block/examples/2/index.less
diff --git a/projects/demo/src/modules/components/radio-block/examples/1/index.ts b/projects/demo/src/modules/components/block/examples/2/index.ts
similarity index 80%
rename from projects/demo/src/modules/components/radio-block/examples/1/index.ts
rename to projects/demo/src/modules/components/block/examples/2/index.ts
index 34fc78f45367..17f0695f0c92 100644
--- a/projects/demo/src/modules/components/radio-block/examples/1/index.ts
+++ b/projects/demo/src/modules/components/block/examples/2/index.ts
@@ -4,12 +4,13 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
@Component({
- selector: 'tui-radio-block-example-1',
+ selector: 'tui-block-example-2',
templateUrl: './index.html',
+ styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
-export class TuiRadioBlockExample1 {
+export class TuiBlockExample2 {
protected readonly testForm = new FormGroup({
testValue: new FormControl('orange'),
});
diff --git a/projects/demo/src/modules/components/block/examples/3/index.html b/projects/demo/src/modules/components/block/examples/3/index.html
new file mode 100644
index 000000000000..5298584211d8
--- /dev/null
+++ b/projects/demo/src/modules/components/block/examples/3/index.html
@@ -0,0 +1,63 @@
+
diff --git a/projects/demo/src/modules/components/checkbox-block/examples/3/index.less b/projects/demo/src/modules/components/block/examples/3/index.less
similarity index 82%
rename from projects/demo/src/modules/components/checkbox-block/examples/3/index.less
rename to projects/demo/src/modules/components/block/examples/3/index.less
index 15b395e7de98..d6953bcb6835 100644
--- a/projects/demo/src/modules/components/checkbox-block/examples/3/index.less
+++ b/projects/demo/src/modules/components/block/examples/3/index.less
@@ -1,5 +1,12 @@
@import '@taiga-ui/core/styles/taiga-ui-local';
+form {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 1rem;
+}
+
.content {
display: flex;
align-items: center;
diff --git a/projects/demo/src/modules/components/checkbox-block/examples/3/index.ts b/projects/demo/src/modules/components/block/examples/3/index.ts
similarity index 80%
rename from projects/demo/src/modules/components/checkbox-block/examples/3/index.ts
rename to projects/demo/src/modules/components/block/examples/3/index.ts
index fc562bd8ef62..fe26fd3185d3 100644
--- a/projects/demo/src/modules/components/checkbox-block/examples/3/index.ts
+++ b/projects/demo/src/modules/components/block/examples/3/index.ts
@@ -4,14 +4,14 @@ import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
@Component({
- selector: 'tui-checkbox-block-example-3',
+ selector: 'tui-block-example-3',
templateUrl: './index.html',
styleUrls: ['./index.less'],
encapsulation,
changeDetection,
})
-export class TuiCheckboxBlockExample3 {
- protected testForm = new FormGroup({
+export class TuiBlockExample3 {
+ protected readonly testForm = new FormGroup({
testValue1: new FormControl(false),
testValue2: new FormControl(false),
testValue3: new FormControl(false),
diff --git a/projects/demo/src/modules/components/checkbox-block/examples/import/import-module.md b/projects/demo/src/modules/components/block/examples/import/import-module.md
similarity index 55%
rename from projects/demo/src/modules/components/checkbox-block/examples/import/import-module.md
rename to projects/demo/src/modules/components/block/examples/import/import-module.md
index 2b04fbd47c26..f1aa5a1c1c39 100644
--- a/projects/demo/src/modules/components/checkbox-block/examples/import/import-module.md
+++ b/projects/demo/src/modules/components/block/examples/import/import-module.md
@@ -1,6 +1,6 @@
```ts
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {TuiCheckboxBlockModule} from '@taiga-ui/kit';
+import {TuiBlockDirective, TuiCheckboxComponent} from '@taiga-ui/kit';
// ...
@@ -8,8 +8,8 @@ import {TuiCheckboxBlockModule} from '@taiga-ui/kit';
imports: [
// ...
FormsModule,
- ReactiveFormsModule,
- TuiCheckboxBlockModule,
+ TuiBlockDirective,
+ TuiCheckboxComponent, // or TuiRadioComponent
],
// ...
})
diff --git a/projects/demo/src/modules/components/block/examples/import/insert-template.md b/projects/demo/src/modules/components/block/examples/import/insert-template.md
new file mode 100644
index 000000000000..0bd48d47e81b
--- /dev/null
+++ b/projects/demo/src/modules/components/block/examples/import/insert-template.md
@@ -0,0 +1,21 @@
+```html
+
+
+
+
+
+```
diff --git a/projects/demo/src/modules/components/checkbox-block/checkbox-block.component.ts b/projects/demo/src/modules/components/checkbox-block/checkbox-block.component.ts
deleted file mode 100644
index 0f68aa2acd5d..000000000000
--- a/projects/demo/src/modules/components/checkbox-block/checkbox-block.component.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import {Component, forwardRef} from '@angular/core';
-import {FormControl, FormGroup} from '@angular/forms';
-import {changeDetection} from '@demo/emulate/change-detection';
-import {TuiDocExample} from '@taiga-ui/addon-doc';
-import {TuiHorizontalDirection, TuiSizeL, TuiSizeXS} from '@taiga-ui/core';
-
-import {AbstractExampleTuiControl} from '../abstract/control';
-import {ABSTRACT_PROPS_ACCESSOR} from '../abstract/inherited-documentation/abstract-props-accessor';
-
-@Component({
- selector: 'example-tui-checkbox-block',
- templateUrl: './checkbox-block.template.html',
- styleUrls: ['./checkbox-block.style.less'],
- changeDetection,
- providers: [
- {
- provide: ABSTRACT_PROPS_ACCESSOR,
- useExisting: forwardRef(() => ExampleTuiCheckboxBlockComponent),
- },
- ],
-})
-export class ExampleTuiCheckboxBlockComponent extends AbstractExampleTuiControl {
- protected readonly exampleForm = import('./examples/import/declare-form.md?raw');
- protected readonly exampleModule = import('./examples/import/import-module.md?raw');
- protected readonly exampleHtml = import('./examples/import/insert-template.md?raw');
-
- protected readonly example1: TuiDocExample = {
- TypeScript: import('./examples/1/index.ts?raw'),
- HTML: import('./examples/1/index.html?raw'),
- };
-
- protected readonly example2: TuiDocExample = {
- TypeScript: import('./examples/2/index.ts?raw'),
- HTML: import('./examples/2/index.html?raw'),
- };
-
- protected readonly example3: TuiDocExample = {
- TypeScript: import('./examples/3/index.ts?raw'),
- HTML: import('./examples/3/index.html?raw'),
- LESS: import('./examples/3/index.less?raw'),
- };
-
- protected readonly contentAlignVariants: readonly TuiHorizontalDirection[] = [
- 'left',
- 'right',
- ];
-
- protected contentAlign: TuiHorizontalDirection = this.contentAlignVariants[1];
-
- protected hideCheckbox = false;
-
- protected readonly sizes: ReadonlyArray = ['xs', 's', 'm', 'l'];
-
- protected currentSize = this.sizes[3];
-
- public readonly control = new FormGroup({
- testValue1: new FormControl(false),
- testValue2: new FormControl(null),
- testValue3: new FormControl(true),
- });
-
- public override get disabled(): boolean {
- return this.control.disabled;
- }
-
- public override set disabled(value: boolean) {
- if (value) {
- this.control.disable();
- } else {
- this.control.enable();
- }
- }
-}
diff --git a/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts b/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts
deleted file mode 100644
index 9d0aa0ec155f..000000000000
--- a/projects/demo/src/modules/components/checkbox-block/checkbox-block.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import {CommonModule} from '@angular/common';
-import {NgModule} from '@angular/core';
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {RouterModule} from '@angular/router';
-import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc';
-import {TuiButtonModule, TuiGroupDirective, TuiTooltipModule} from '@taiga-ui/core';
-import {
- TuiAvatarComponent,
- TuiCheckboxBlockModule,
- TuiRadioListModule,
-} from '@taiga-ui/kit';
-
-import {InheritedDocumentationModule} from '../abstract/inherited-documentation/inherited-documentation.module';
-import {ExampleTuiCheckboxBlockComponent} from './checkbox-block.component';
-import {TuiCheckboxBlockExample1} from './examples/1';
-import {TuiCheckboxBlockExample2} from './examples/2';
-import {TuiCheckboxBlockExample3} from './examples/3';
-
-@NgModule({
- imports: [
- CommonModule,
- FormsModule,
- TuiCheckboxBlockModule,
- TuiGroupDirective,
- TuiAddonDocModule,
- InheritedDocumentationModule,
- ReactiveFormsModule,
- CommonModule,
- TuiAvatarComponent,
- TuiRadioListModule,
- TuiButtonModule,
- TuiTooltipModule,
- RouterModule.forChild(tuiGenerateRoutes(ExampleTuiCheckboxBlockComponent)),
- ],
- declarations: [
- TuiCheckboxBlockExample1,
- TuiCheckboxBlockExample2,
- TuiCheckboxBlockExample3,
- ExampleTuiCheckboxBlockComponent,
- ],
- exports: [ExampleTuiCheckboxBlockComponent],
-})
-export class ExampleTuiCheckboxBlockModule {}
diff --git a/projects/demo/src/modules/components/checkbox-block/checkbox-block.style.less b/projects/demo/src/modules/components/checkbox-block/checkbox-block.style.less
deleted file mode 100644
index 01f67c652de2..000000000000
--- a/projects/demo/src/modules/components/checkbox-block/checkbox-block.style.less
+++ /dev/null
@@ -1,5 +0,0 @@
-@import '@taiga-ui/core/styles/taiga-ui-local';
-
-.wrapper {
- margin-top: 1.875rem;
-}
diff --git a/projects/demo/src/modules/components/checkbox-block/checkbox-block.template.html b/projects/demo/src/modules/components/checkbox-block/checkbox-block.template.html
deleted file mode 100644
index 976341360341..000000000000
--- a/projects/demo/src/modules/components/checkbox-block/checkbox-block.template.html
+++ /dev/null
@@ -1,173 +0,0 @@
-
-
-
- CheckboxBlock
- can be used in forms where selected option does not change or update content (e.g. does not work like a
- filter). It may be grouped in horizontal row only except the mobile view
-
-
-
-
-
- Disabled state (use
- formControl.disable()
- )
-
-
- Radio and content position
-
-
- Hide radio button
-
-
- Function that matches value and items, e.g. if objects are copied. Uses
- ===
- by default.
-
- Must be a pure function
-
-
- Emulates disabled state without disabling a form
-
-
- Size
-
-
-
-
-
-
-
-
-
- Import an Angular module for forms and
- TuiRadioBlockModule
- in the same module where you want to use our component:
-
-
-
-
-
-
-
- Declare a form (
- FormGroup
- ) or a control (
- FormControl
- ) in your component:
-