feat: register custom text sizes and radii with tailwind-merge

This commit is contained in:
rajun 2026-10-27 16:28:47 +05:30
parent a74a2c6200
commit a7091c126a

View File

@ -1,5 +1,16 @@
import { clsx, type ClassValue } from 'clsx'; import { clsx, type ClassValue } from 'clsx';
import { twMerge } from 'tailwind-merge'; import { extendTailwindMerge } from 'tailwind-merge';
// Teach tailwind-merge the custom @theme sizes and radii in app.css, so e.g. `text-display`
// is treated as a font size (not dropped as a colour) and radius overrides replace each other
const twMerge = extendTailwindMerge({
extend: {
theme: {
text: ['3xs', '2xs', 'md', 'display'],
radius: ['chip', 'option', 'item', 'control', 'group', 'field', 'card-sm', 'card', 'panel', 'phone', 'phone-screen'],
},
},
});
export function cn(...inputs: ClassValue[]) { export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs)); return twMerge(clsx(inputs));