All Projects → thien-do → Typed.tw

thien-do / Typed.tw

Brings types to TailwindCSS via TypeScript.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Typed.tw

chat-app
A chat app built with Node.js, Socket.io, React.js, and Tailwind CSS.
Stars: ✭ 29 (-91.47%)
Mutual labels:  tailwindcss
Formvuelar
Vue form components with server-side validation in mind
Stars: ✭ 263 (-22.65%)
Mutual labels:  tailwindcss
Laravel Form Components
A set of Blade components to rapidly build forms with Tailwind CSS (v1.0 and v2.0) and Bootstrap 4. Supports validation, model binding, default values, translations, Laravel Livewire, includes default vendor styling and fully customizable!
Stars: ✭ 295 (-13.24%)
Mutual labels:  tailwindcss
fiber-boilerplate
This is the go boilerplate on the top of fiber web framework. With simple setup you can use many features out of the box
Stars: ✭ 184 (-45.88%)
Mutual labels:  tailwindcss
Svgwave
🌊 SVG Wave is a tiny, free and beautiful SVG gradient waves generator for your UI or website desgin. It offers dead simple UI to customize, and style your waves based on your theme specifications.
Stars: ✭ 255 (-25%)
Mutual labels:  tailwindcss
Kutty
Kutty is a tailwind plugin for building web applications. It has a set of accessible and reusable components that are commonly used in web applications.
Stars: ✭ 264 (-22.35%)
Mutual labels:  tailwindcss
angular-boilerplate
⛩️ Angular starter for enterprise-grade front-end projects, built under a clean architecture that helps to scale and maintain a fast workflow.
Stars: ✭ 158 (-53.53%)
Mutual labels:  tailwindcss
Tall Forms
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.
Stars: ✭ 321 (-5.59%)
Mutual labels:  tailwindcss
Dmarman.github.io
Tailwind Ink is an AI palette generator trained with the Tailwindcss colors.
Stars: ✭ 254 (-25.29%)
Mutual labels:  tailwindcss
Windmill Dashboard React
❄ A multi theme, completely accessible, ready for production dashboard.
Stars: ✭ 283 (-16.76%)
Mutual labels:  tailwindcss
platforms
A template for site builders and low-code tools.
Stars: ✭ 1,156 (+240%)
Mutual labels:  tailwindcss
I Hate Regex
The code for iHateregex.io 😈 - The Regex Cheat Sheet
Stars: ✭ 3,176 (+834.12%)
Mutual labels:  tailwindcss
Kickoff tailwind
A rapid Rails 6 application template for personal use bundled with Tailwind CSS
Stars: ✭ 287 (-15.59%)
Mutual labels:  tailwindcss
Next-JS-Landing-Page-Starter-Template
🚀 Free NextJS Landing Page Template written in Tailwind CSS 3 and TypeScript ⚡️ Made with developer experience first: Next.js 12 + TypeScript + ESLint + Prettier + Husky + Lint-Staged + VSCode + Netlify + PostCSS + Tailwind CSS
Stars: ✭ 521 (+53.24%)
Mutual labels:  tailwindcss
Tailwindcss Classnames
TypeScript support for TailwindCSS
Stars: ✭ 305 (-10.29%)
Mutual labels:  tailwindcss
nextjs-portfolio
Source Code for my rebranded personal website and portfolio.
Stars: ✭ 23 (-93.24%)
Mutual labels:  tailwindcss
Admin
admin panel template built on tailwind css 🎉
Stars: ✭ 268 (-21.18%)
Mutual labels:  tailwindcss
Gridsome Portfolio Starter
A simple portfolio theme for Gridsome powered by Tailwind CSS v1
Stars: ✭ 329 (-3.24%)
Mutual labels:  tailwindcss
Babel Plugin Tailwind Components
Use Tailwind with any CSS-in-JS library
Stars: ✭ 320 (-5.88%)
Mutual labels:  tailwindcss
Sapper Ecommerce
Svelte ecommerce - Headless, Authentication, Cart & Checkout, TailwindCSS, Server Rendered, Proxy + API Integrated, Animations, Stores, Lazy Loading, Loading Indicators, Carousel, Instant Search, Faceted Filters, 1 command deploy to production, Open Source, MIT license. Join us as contributor ([email protected])
Stars: ✭ 289 (-15%)
Mutual labels:  tailwindcss

Typed Tailwind · typed.tw

Typed Tailwind brings types to Tailwind CSS by generating TypeScript classes (example) whose methods let you use the utility classes generated from your Tailwind config:

Code completion

Try it live at typed.tw!

Jump to: Why · Usage · Examples · FAQ · Credits · License

Why

I wanted to combine the 2 great things in Front End engineering nowadays: static typing and functional CSS. Turn out, they get along very well. The constraint and predictability of utilities classes makes them ideal candidates to be statically typed as methods of a TypeScript class.

Error catching

Is it more than just code completion? Yes. Code completion is just suggestion. Static typing enforces the correctness of your code styling, so you can do things like defining better API, automated code refactoring, and errors (like using undefined colors) can be caught at compile time.

Usage

  1. Go to typed.tw (or typed-tailwind.com if you can't access .tw domain) and paste your Tailwind configuration into the first panel.
  2. Save the generated file in the second panel to your codebase.
  3. Import the Tw function from that file and use its (chain-able) methods:
// In practice, the file should be imported using absolute path
import { Tw } from "./tw";

const Foo = () => (
  <p className={Tw().textBlue().fontBold().$()}>
    Bold, blue text
  </p>
);

Example usages:

Compile time usage with Webpack

Above is a run time usage. It allows you to easily add Typed Tailwind to many projects and build systems (e.g. it works with CRA without ejecting). However, it has some problems:

  • The bundled JS is bigger because it includes the whole generated TypeScript class that reflects all possible values from your Tailwind configuration, even if you don't use them.
  • It's a little bit slower for users because class names are looked up and concatenated at run time.
  • Other tools like PurgeCSS cannot process the code out of the box.

Therefore, we have a typed-tailwind-loader to apply all Tw()...$() calls at compile time (as a part of your webpack build process, to be exact). This eliminates all 3 issues above.

Examples

FAQ

Where to put the generated file?

The file should be imported from many places in your codebase so place it where you can take advantage of absolute imports. For example, if you are using CRA and your baseUrl is the src folder then you can place the file at src/tw/index.ts.

import { Tw } from "tw";

Does it work without TypeScript?

Yes. You can always compile the generated file to JS, optionally with a declaration file:

tsc --declaration style.ts

This way, you still get full code completion, just no compile time type checking.

Does it work with PurgeCSS?

Yes. Please see Compile time usage with Webpack section. If you can't follow that, try remove unused values to reduce the bundled size.

Does it work with custom plugins?

It's not officially supported yet but could work if your plugins are defined as inline anonymous functions (like in the docs). Also see: Does it work with custom classes.

Does it work with custom classes?

Yes. The result is simply a source file, so feel free to modify it anyway you want:

// style.ts

class Tailwind {
  /* ... */
  
  // Add your custom ones:
  textShadow(): Tailwind { return this.add("text-shadow"); }
}

Is there any performance issue?

Out of the box, maybe, because styling are applied at run-time, on render to be specific. However, you can use it at compile time to eliminate all of these issues.

If you can't modify your build config, or if you don't use webpack, it helps a little bit by moving the calls out of the renders. The work is still done at run time, but just once at start-up instead of every render.

const styles = Tw().fontBold().textBlue().$();

const Foo = () => <p className={styles} />;

The generated code style doesn't match ours. Can I reformat it?

Yes. The generated code should be checked into your source control so you can (and should) format it with your code formatter. In other words, just judge it as your own source code.

Credits

Alternatives

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].