Skip to content

Releases: nextui-org/tailwind-variants

v0.1.0

11 Mar 13:55
Compare
Choose a tag to compare

What's Changed

πŸš€ Features

  • On-Demand transform. by @tianenpang
  • New config api responsiveVariants. by @tianenpang
  • New parameter added compoundSlots to apply classes to multiple slots at once, this reduces the amount of repeated code by @jrgarciadev
  • tailwind-merge package upgraded to 1.10.0 by @jrgarciadev

πŸ› Fixes

  • Fixed issue with failed transform when using extend. by @tianenpang
  • Fixed issue with children slots are now being returned for extended tv functions with slots #23 by @jrgarciadev

βš™οΈ Refactor

πŸ”΄ Breaking Changes

To be able to use Responsive Variants you need to include responsiveVariants: true or responsiveVariants:['xs', 'sm', ....allDesiredVariants'] in the configuration object. This ensures that tv functions only generate responsive variants for the specified breakpoints, significantly reducing the amount of CSS generated in the final bundle.

Example:

const button = tv({
  base: "font-semibold text-white py-1 px-3 rounded-full active:opacity-80",
  variants: {
	color: {
		primary: "bg-blue-500 hover:bg-blue-700",
		secondary: "bg-purple-500 hover:bg-purple-700",
		success: "bg-green-500 hover:bg-green-700",
	},
	size: {
		small: "py-1 px-2 text-xs",
		medium: "py-1 px-2 text-sm",
		large: "py-1.5 px-3 text-md",
	},
  },
},
+ {
+  responsiveVariants: ['sm', 'md']
+ }
);

// the function call remains unchanged.
button({
	color: {
		initial: "primary",
		sm: "success",
		md: "secondary",
	},
	size: {
		initial: "small",
		sm: "medium",
		md: "large",
	},
})}

Credits

Huge thanks to @tianenpang πŸ™πŸ»

Stay tuned to the documentation website for examples. πŸš€

Full Changelog: v0.0.31...v0.1.0

v0.0.31

08 Mar 00:10
Compare
Choose a tag to compare

What's Changed

  • fix duplication typo by @yjose in #16
  • fix: types export ClassPropand ClassValue
  • chore: utils moved to the main file
  • chore: tv tests improved

New Contributors

  • @yjose made their first contribution in #16

Full Changelog: v0.0.29...v0.0.31

v0.0.29

05 Feb 13:27
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/nextui-org/tailwind-variants/commits/v0.0.29