# Add arrow between two tcolorboxes

I'm new to tikz. I'm trying to create something like this:

The two tcolorboxes work fine outside of being nodes. After googling and reading tikz documentation, I'm still at a loss for how to draw an arrow! Here's my MWE that is sad and needs smarts beyond my capacity at this moment.

\documentclass[12pt,fleqn,twoside]{report}
\usepackage{tcolorbox}
\usepackage{tikz}

\tcbset{%
boxrule=4pt,
colback=white, %background color
colframe=blue, % frame colour
halign=center,
valign=center,
halign lower=center,
align lower =center,
sharp corners=all,
center title,
lower separated=false,
fonttitle=\sffamily\bfseries\large,
}

\begin{document}

\begin{tikzpicture}[node distance=2cm,baseline=-0.5ex,  arrow/.style = {thick,-stealth}]
\node(NodeName1){
\begin{tcolorbox}[title=Box1Title]
Blah box1 text
\end{tcolorbox}
};
\node(NodeName2){
\begin{tcolorbox}[title=Box2Title]
Blah box2 text
\end{tcolorbox}
};
\draw(NodeName1);
\draw[->] (NodeName1) -- (NodeName2);
\draw(NodeName2);
\end{tikzpicture}

\end{document}


arrow is not the problem (actually it appears), but your nodes overlaps (are not displaced one against other) and consequently its length is zero pt. also you have errors in your code (undefined options) and since width of boxes are not defined, it use default width, e.g. text width ...

\documentclass[12pt,fleqn,twoside]{report}
\usepackage[many]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, % for arrows style
positioning  % for positioning of boxes
}
\tcbset{%
boxrule=4pt,
colback=white, % background color
colframe=cyan, % frame colour
halign=center,
valign=center,
sharp corners=all,
center title,
lower separated=false,
fonttitle=\sffamily\bfseries\large,
}
% for show only picture
\usepackage[tightpage, active]{preview}
\setlength\PreviewBorder{3mm}
\PreviewEnvironment{tikzpicture}

\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node(NodeName1){
\begin{tcolorbox}[title=Box 1 Title]
Box 1 text
\end{tcolorbox}
};
\node(NodeName2) [right=of NodeName1] {  % added position of second box
\begin{tcolorbox}[title=Box 2 Title]
Box 2 longer text text text text text
\end{tcolorbox}
};
\draw[blue, line width=2mm,-{Triangle[angle=60:1pt 3]}] (NodeName1) -- (NodeName2);
\end{tikzpicture}
\end{document}


see if obtained image is what you looking for:

edit: code and explanation is slightly improved

You don't have to included your tcolorboxes as tikznodes inside a tikzpicture for drawing arrows between them. In fact a tcolorbox is more or less a tikzpicture.

With enhanced tcolorboxes, you can use remember as= ... option to assign a name to each box and use these names for reference in a tikzpicture. This is what is shown in following example.

enhanced options has bee added to tcbset declaration (load tcolorbox with most option). Then a nobeforeafter option has been used in each box to keep them on the same line and remember as option for naming them.

An external picture has been used to draw the arrow between these boxes:

\documentclass[12pt,fleqn,twoside]{report}
\usepackage[most]{tcolorbox}
\usepackage{tikz}

\tcbset{%
enhanced,
boxrule=4pt,
colback=white, %background color
colframe=blue, % frame colour
halign=center,
valign=center,
halign lower=center,
valign lower =center,
sharp corners=all,
center title,
lower separated=false,
fonttitle=\sffamily\bfseries\large,
}

\begin{document}

\begin{tcolorbox}[title=Box1Title, width=.4\linewidth, nobeforeafter, remember as=NodeName1]
Blah box1 text
\end{tcolorbox}
\hfill
\begin{tcolorbox}[title=Box2Title, width=.4\linewidth, nobeforeafter, remember as=NodeName2]
Blah box2 text
\end{tcolorbox}

\tikz[overlay, remember picture] \draw[->, line width=4pt, blue] (NodeName1)--(NodeName2);

\end{document}


• Thank you @Ignasi. You gave me alternate solution that I can use elsewhere. I understand tikz more by looking at your response. – PepPaddy Sep 13 '17 at 18:18