Tailwind CSS for your PCF control

Ahmad SammourAhmad Sammour
2 min read

What is TailwindCSS?

Tailwind CSS is a utility-first CSS framework packed with classes like that can be composed to build any design, directly in your markup.

Check their website here

image.png

image.png

image.png

How it works?

Tailwind CSS works by scanning all of your HTML files, JavaScript components, and any other templates for class names, generating the corresponding styles and then writing them to a static CSS file.

It's fast, flexible, and reliable — with zero-runtime.

Check the docs here

Why?

✅ Tiny size files, ship only used css

✅ Light weight attractive components

✅ Build fully responsive components easy!

✅ VSCode intellisense

✅ Fully customizable

✅ Available plugins available

✅ You work on your component, css file gets updated automatically!

✅ Lots of ready components from Tailwind or from developer communities

Installation

Follow the installation docs here but in step number 5 do the below,

in the manifest file in your PCF control, load the generated css file (the one you generated from step 4)

<resources>
      <code path="index.ts" order="1"/>
      <css path="generated/style.css" order="1" />
    </resources>

Usage

After you install the Tailwind extension on VS code, just write css in your tsx, or jsx and the terminal session running from step 4 will take care of it.

<p className="mt-2 text-sm text-gray-700">

these will be translated to the below automatically!

.mt-2 {
    margin-top: 0.5rem/* 8px */;
}
.text-sm {
    font-size: 0.875rem/* 14px */;
    line-height: 1.25rem/* 20px */;
}
.text-gray-700 {
    --tw-text-opacity: 1;
    color: rgb(55 65 81 / var(--tw-text-opacity));
}

powerapps-modals with Tailwind CSS

💻 powerapps-modals built with TailwindCSS, it was easy to build attractive dynamic modals.

image.png

🧑‍💻 Check source code here

Useful links

📃 Docs

🖲️ Components

🧭 Tailwindcomponents.com

Happy PCFing!

0
Subscribe to my newsletter

Read articles from Ahmad Sammour directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ahmad Sammour
Ahmad Sammour

👋 I am a Low code/no code enthusiast with 7+ years of experience in 𝐌𝐢𝐜𝐫𝐨𝐬𝐨𝐟𝐭 𝐏𝐨𝐰𝐞𝐫𝐏𝐥𝐚𝐭𝐟𝐨𝐫𝐦, 𝐃𝐲𝐧𝐚𝐦𝐢𝐜𝐬 𝟑𝟔𝟓 business apps and experience in other platforms and technologies. I help companies deliver solutions with a real business impact. Drove implementations for satisfied clients by ⬆️ 𝙢𝙖𝙭𝙞𝙢𝙞𝙯𝙞𝙣𝙜 𝙫𝙖𝙡𝙪𝙚, ⬇️ 𝙢𝙞𝙣𝙞𝙢𝙞𝙯𝙞𝙣𝙜 𝙧𝙞𝙨𝙠 with a focus on delivering business value, decreasing technical debt and ability to cope with rapid market changes.