Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form field layout and placeholder issues after adding TailwindCSS v3

I am using Angular 15 with Angular Material 15, then I have added Tailwind CSS as per the instruction https://v3.tailwindcss.com/docs/guides/angular.

The material component design got mismatched as shown below:

enter image description here

The placeholder name is truncated as it should be:

enter image description here

The line appears in the text box.

style.scss

@tailwind base;
@tailwind components;
@tailwind utilities;

tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{html,ts}",
    ],
  theme: {
    extend: {},
  },
  plugins: [],
}
like image 910
San Jaisy Avatar asked Mar 10 '26 21:03

San Jaisy


1 Answers

You must add into your tailwind.config.js in module.exports the next config:

/** @type {import('tailwindcss').Config} */
module.exports = {
  corePlugins: {
    preflight: false
  },
}

Using the above solution can cause some problems with TailwindCSS classes. For this reason it is better to add the following lines in style.scss:

.mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field .mdc-notched-outline__notch {
  border-right-style: hidden;
}
like image 120
Yorguin Augusto Lopez Ortiz Avatar answered Mar 12 '26 09:03

Yorguin Augusto Lopez Ortiz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!