Search code examples
angulardevextreme

Styling DevExtreme text box


For my project i'm using devextreme with angular and i have some difficulties styling it's input (text-box). I tried every possible way of targeting it in css and just wont do it.. These two in css are just fragment of what i have tried. If someone can help me i would much appreciate it. Here is my HTML:

<dx-validation-group>
    <dx-text-box id="code" placeholder="ENTER YOUR CODE" [(value)]="code" width="300">
        <dx-validator [validationRules]="[{
              type: 'required',
              message: 'Code is required'
          }]"></dx-validator>
    </dx-text-box>
    <dx-button id="submit-button" text="LOGIN" (onClick)="validate($event)" [useSubmitBehavior]="true"></dx-button>
</dx-validation-group>

and css:

#code {
    margin: 20px auto;
    color: white;
    border: 0;
    outline: 0;
    background: transparent;
    border-bottom: 1px solid white;
    text-align: center;
    font-size: 18px !important;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

#code .dx-texteditor-input {
    margin: 20px auto;
    color: white;
    border: 0;
    outline: 0;
    background: transparent;
    border-bottom: 1px solid white;
    text-align: center;
    font-size: 18px !important;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

Solution

  • You should use shadow-piercing descendant combinator like /deep/ or ::ng-deep (angular ^4.3.0 (2017-07-14)) to force a style down through the child component tree into all the child component views.

    #code /deep/ .dx-texteditor-input {
      ...
    }
    

    Plunker Example

    See also