oui-kit
Version:
🎯 *UI toolkit with a French touch* 🇫🇷
19 lines (18 loc) • 641 B
TypeScript
export declare function px(value: number | string): string;
/**
* Convert px values to rem units.
* A special opinionated measurement inspired by Stylus "rex".
* We assume that 1rem == 16px, so 1rex == 0.0625rem.
* The advantage is that sizes nicely scale to different default font sizes.
*
* @param value - Number (treated as px) or string with unit
* @returns Value converted to rem, or original string if it already has a unit
*
* @example
* rex(16) // '1rem'
* rex(8) // '0.5rem'
* rex('24px') // '1.5rem'
* rex('2rem') // '2rem' (unchanged)
* rex(0) // '0'
*/
export declare function rex(value: number | string): string;