@@ -4,47 +4,7 @@ import {
44} from '@angular/core' ;
55
66/**
7- * `DaffCompactableDirective` allows a component to conditionally apply a compact
8- * style by toggling a CSS class. This is useful for creating components that can
9- * switch between regular and compact styles based on the `compact` property.
10- *
11- * @example Implementing it as an attribute directive
12- *
13- * ```html
14- * <div daffCompactable [compact]="isCompact">Content goes here</div>
15- * ```
16- *
17- * In this example, the `daff-compact` class is applied to the `div` element when
18- * `isCompact` is `true`, making the `div` display its compact state.
19- *
20- * @example Implementing it as an Angular host directive
21- *
22- * ```ts
23- * @Component ({
24- * selector: 'custom-component',
25- * template: 'custom-component.html',
26- * hostDirectives: [
27- * {
28- * directive: DaffCompactableDirective,
29- * inputs: ['compact'],
30- * },
31- * ],
32- * })
33- * export class CustomComponent { }
34- * ```
35- *
36- * The directive applies the `daff-compact` class to the component and
37- * should be defined in your styles to display the compact state as desired.
38- *
39- * ```scss
40- * :host {
41- * padding: 8px 16px;
42- *
43- * &.daff-compact {
44- * padding: 4px 8px;
45- * }
46- * }
47- * ```
7+ * Enforces consistent use of the compact property.
488 */
499@Directive ( {
5010 selector : '[daffCompactable]' ,
@@ -54,7 +14,7 @@ import {
5414} )
5515export class DaffCompactableDirective {
5616 /**
57- * Controls whether the component is compact.
17+ * Whether the component is compact.
5818 */
5919 @Input ( ) compact = false ;
6020}
0 commit comments