SkillAgentSearch skills...

Twind.macro

This package is been moved into tw-in-js/twind-jsx-preprocessor monorepo.

Install / Use

/learn @tw-in-js/Twind.macro
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

This package is been moved into tw-in-js/twind-jsx-preprocessor:packages/macro.

Please check out the new tw-in-js/twind-jsx-preprocessor monorepo.

@twind/macro

Enables the use of the tw prop, for use with twind

import "@twind/macro"
const Button = () => <button tw="bg-blue-500" />

// ⬇⬇⬇⬇⬇⬇

import { tw } from "twind"
const Button = () => <button className={tw`bg-blue-500`} />

More complex usage is supported:

import "@twind/macro"

const Button = () => (
	<button
		tw={[
			"bg-blue-500",
			condition && "text-red-500",
			{ "border-green-500": true },
		]}
	/>
)

// ⬇⬇⬇⬇⬇⬇

import { tw } from "twind"

const Button = () => (
	<button
		className={tw([
			"bg-blue-500",
			condition && "text-red-500",
			{ "border-green-500": true },
		])}
	/>
)

Installation

  1. Add babel-plugin-macros to your babel config (if you use Create React App, it's already installed!)
  2. Run npm install @twind/macro
  3. Enjoy ☺
View on GitHub
GitHub Stars11
CategoryDevelopment
Updated2y ago
Forks0

Languages

TypeScript

Security Score

60/100

Audited on Aug 21, 2023

No findings