I found a solution! You need to redefine/create a template command. I used the code bellow to redefine the default template.
\DefTblrTemplate { caption } { normal }
{
\hbox_set:Nn \l__tblr_caption_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
\UseTblrTemplate { caption-text } { default }
}
\dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
{
\UseTblrAlign { caption }
\UseTblrIndent { caption }
\hbox_set:Nn \l__tblr_caption_left_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
}
\hangindent = \box_wd:N \l__tblr_caption_left_box
\hangafter = 1
\UseTblrHang { caption }
\leavevmode
\hbox_unpack:N \l__tblr_caption_box
\par
}
{
\centering
\makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
\par
}
}
I redefined the default style to this:
\DefTblrTemplate { caption } { default }
{
\hbox_set:Nn \l__tblr_caption_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
\UseTblrTemplate { caption-text } { default }
}
\dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
{
\UseTblrAlign { caption }
\UseTblrIndent { caption }
\hbox_set:Nn \l__tblr_caption_left_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
}
\hangindent = \box_wd:N \l__tblr_caption_left_box
\hangafter = 1
\UseTblrHang { caption }
\leavevmode
\hbox_unpack:N \l__tblr_caption_box
\par
}
{
\marginnote { \box_use:N \l__tblr_caption_box }
\par
}
}
Here I changed these lines of placement:
\centering
\makebox [\hsize] [c] { \box_use:N \l__tblr_caption_box }
\par
To these lines:
\marginnote { \box_use:N \l__tblr_caption_box }
\par
Now the caption is in the margin. Unfortunately, the \marginpar command does not work, if you try to use it, you will get the error: ! LaTeX Error: Not in outer par mode. So, you need to use the package marginnote to get the correct command.
The complete code:
\documentclass[12pt, mpinclude]{scrbook}
\usepackage{tabularray}
\usepackage{marginnote}
\begin{document}
\ExplSyntaxOn
\DefTblrTemplate { caption } { default }
{
\hbox_set:Nn \l__tblr_caption_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
\UseTblrTemplate { caption-text } { default }
}
\dim_compare:nNnTF { \box_wd:N \l__tblr_caption_box } > { \hsize }
{
\UseTblrAlign { caption }
\UseTblrIndent { caption }
\hbox_set:Nn \l__tblr_caption_left_box
{
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { default }
}
\hangindent = \box_wd:N \l__tblr_caption_left_box
\hangafter = 1
\UseTblrHang { caption }
\leavevmode
\hbox_unpack:N \l__tblr_caption_box
\par
}
{
\marginnote { \box_use:N \l__tblr_caption_box }
\par
}
}
\ExplSyntaxOff
\DefTblrTemplate{caption-tag}{default}{Tabela\hspace{0.25em}\thetable}
\DefTblrTemplate{caption-sep}{default}{-\enskip}
\DefTblrTemplate{caption-text}{default}{\InsertTblrText{caption}}
\begin{longtblr}[caption={one table}]{colspec = {X[c]X[c]X[c]}}
1 & 2& 3 &\
4 & 5& 6\
7 & 8 & 9 \
\end{longtblr}
\end{document}
The output:

longtblrsolution. If so, I think you have to redefine some commands of the package, which is unfortunately not that easy. Maybe contact the package author for further help. – marv Dec 20 '21 at 07:49longtblrsolution! I redefined the commands and, for me, worked. – TheEndofTheWorld Dec 20 '21 at 13:50