The DaffTextAlignableDirective
allows for dynamic text alignment of a component
by setting CSS classes based on the specified text alignment. This directive is
useful when text alignment needs to be managed dynamically in an Angular component.
<div daffTextAlignable textAlignment="center">Aligned text</div>
While the native CSS text-align
property can be used for static text alignment,
the DaffTextAlignableDirective
provides a structured and consistent way to handle
dynamic text alignment within Angular components in more complex use-cases
application of text-align:center
would cause unexpected side effects.
'[daffTextAlignable]'
Name | Type | Description | |||
---|---|---|---|---|---|
@Input() textAlignment | DaffTextAlignment |
The text-alignment of a component. | defaultAlignment | DaffTextAlignment |
Sets a default textAlignment. |
ngOnChanges |