DaffTextAlignableDirective

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.

Example

<div daffTextAlignable textAlignment="center">Aligned text</div>

Why not just use CSS?

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.

Selector: '[daffTextAlignable]'

Properties

Name Type Description
@Input() textAlignment DaffTextAlignment The text-alignment of a component. defaultAlignment DaffTextAlignment Sets a default textAlignment.
ngOnChanges
Graycore, LLC © 2018 - 2024. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.