Search code examples
polymer

How to use a fixed font in Polymer's paper-textarea?


When using the following Polymer component:

<paper-textarea value="test"></paper-textarea>

I did not find any way to change its font to a fixed font. (for code entry)

I tried the following styling, but just the color was actually applied:

<style is="custom-style">
  :root {
    --paper-input-container-input-color: blue;
    /* the following lines do not work... */
    --paper-input-font-family: monospace;
    --iron-autogrow-textarea: {
      font-family: monospace;
    };
  }
</style>

Any one knows how to do that?


Solution

  • paper-textarea uses iron-autogrow-textarea. This should work (not tried myself)

    <style is="custom-style">
      :root {
        --iron-autogrow-textarea: {
          font-family: monospace !important;
        };
      }
    </style>