5252 :closeButton =" toastOptions?.closeButton ?? closeButton"
5353 :interacting =" interacting"
5454 :position =" pos"
55+ :closeButtonPosition =" toastOptions?.closeButtonPosition ?? closeButtonPosition"
5556 :style =" toastOptions?.style"
5657 :unstyled =" toastOptions?.unstyled"
5758 :classes =" toastOptions?.classes"
@@ -163,6 +164,7 @@ defineOptions({
163164const props = withDefaults (defineProps <ToasterProps >(), {
164165 invert: false ,
165166 position: ' bottom-right' ,
167+ closeButtonPosition: ' top-left' ,
166168 hotkey : () => [' altKey' , ' KeyT' ],
167169 expand: false ,
168170 closeButton: false ,
@@ -489,9 +491,6 @@ html[dir='ltr'],
489491 --toast-svg-margin-end : 0px ;
490492 --toast-button-margin-start : auto ;
491493 --toast-button-margin-end : 0 ;
492- --toast-close-button-start : 0 ;
493- --toast-close-button-end : unset ;
494- --toast-close-button-transform : translate (-35% , -35% );
495494}
496495
497496html [dir = ' rtl' ],
@@ -502,9 +501,6 @@ html[dir='rtl'],
502501 --toast-svg-margin-end : -1px ;
503502 --toast-button-margin-start : 0 ;
504503 --toast-button-margin-end : auto ;
505- --toast-close-button-start : unset ;
506- --toast-close-button-end : 0 ;
507- --toast-close-button-transform : translate (35% , -35% );
508504}
509505
510506[data-sonner-toaster ] {
@@ -699,11 +695,44 @@ html[dir='rtl'],
699695 background : rgba (255 , 255 , 255 , 0.3 );
700696}
701697
698+ [data-sonner-toaster ] [data-close-button-position = ' top-left' ] {
699+ --toast-close-button-left : 0 ;
700+ --toast-close-button-right : unset ;
701+ --toast-close-button-top : 0 ;
702+ --toast-close-button-bottom : unset ;
703+ --toast-close-button-transform : translate (-35% , -35% );
704+ }
705+
706+ [data-sonner-toaster ] [data-close-button-position = ' top-right' ] {
707+ --toast-close-button-left : unset ;
708+ --toast-close-button-right : 0 ;
709+ --toast-close-button-top : 0 ;
710+ --toast-close-button-bottom : unset ;
711+ --toast-close-button-transform : translate (35% , -35% );
712+ }
713+
714+ [data-sonner-toaster ] [data-close-button-position = ' bottom-left' ] {
715+ --toast-close-button-left : 0 ;
716+ --toast-close-button-right : unset ;
717+ --toast-close-button-top : unset ;
718+ --toast-close-button-bottom : 0 ;
719+ --toast-close-button-transform : translate (-35% , 35% );
720+ }
721+
722+ [data-sonner-toaster ] [data-close-button-position = ' bottom-right' ] {
723+ --toast-close-button-left : unset ;
724+ --toast-close-button-right : 0 ;
725+ --toast-close-button-top : unset ;
726+ --toast-close-button-bottom : 0 ;
727+ --toast-close-button-transform : translate (35% , 35% );
728+ }
729+
702730[data-sonner-toast ][data-styled = ' true' ] [data-close-button ] {
703731 position : absolute ;
704- left : var (--toast-close-button-start );
705- right : var (--toast-close-button-end );
706- top : 0 ;
732+ left : var (--toast-close-button-left );
733+ right : var (--toast-close-button-right );
734+ top : var (--toast-close-button-top );
735+ bottom : var (--toast-close-button-bottom );
707736 height : 20px ;
708737 width : 20px ;
709738 display : flex ;
@@ -1205,4 +1234,4 @@ html[dir='rtl'],
12051234 opacity : 0 ;
12061235 transform : scale (0.8 ) translate (-50% , -50% );
12071236}
1208- </style >
1237+ </style >
0 commit comments