@@ -592,6 +592,40 @@ export const borderWidthRule: UtilityRule = (parsed) => {
592592 }
593593}
594594
595+ // Border side width utilities (border-t-0, border-r-2, border-x-4, etc.)
596+ export const borderSideWidthRule : UtilityRule = ( parsed ) => {
597+ const sideUtilities : Record < string , string | string [ ] > = {
598+ 'border-t' : 'border-top-width' ,
599+ 'border-r' : 'border-right-width' ,
600+ 'border-b' : 'border-bottom-width' ,
601+ 'border-l' : 'border-left-width' ,
602+ 'border-x' : [ 'border-left-width' , 'border-right-width' ] ,
603+ 'border-y' : [ 'border-top-width' , 'border-bottom-width' ] ,
604+ }
605+
606+ const prop = sideUtilities [ parsed . utility ]
607+ if ( ! prop )
608+ return undefined
609+
610+ // Width values: 0, 2, 4, 8 (or default to 1px if no value)
611+ const widthMap : Record < string , string > = {
612+ 0 : '0px' ,
613+ 2 : '2px' ,
614+ 4 : '4px' ,
615+ 8 : '8px' ,
616+ }
617+
618+ const width = parsed . value ? widthMap [ parsed . value ] : '1px'
619+ if ( ! width )
620+ return undefined
621+
622+ if ( Array . isArray ( prop ) ) {
623+ return prop . reduce ( ( acc , p ) => ( { ...acc , [ p ] : width } ) , { } as Record < string , string > )
624+ }
625+
626+ return { [ prop ] : width }
627+ }
628+
595629export const borderRadiusRule : UtilityRule = ( parsed , config ) => {
596630 if ( parsed . utility === 'rounded' ) {
597631 const value = parsed . value ? config . theme . borderRadius [ parsed . value ] : config . theme . borderRadius . DEFAULT
@@ -661,7 +695,8 @@ export const builtInRules: UtilityRule[] = [
661695 // Forms utilities
662696 ...formsRules ,
663697
664- // Border rules
698+ // Border rules (specific side rules first)
699+ borderSideWidthRule ,
665700 borderWidthRule ,
666701 borderRadiusRule ,
667702
0 commit comments