Formatiing text inside tikz node
It is not clear to me what your ultimate goal is but I recommend against putting tabular
environments inside \node
's as there are usually better ways to do this. Of course, this really depends on what you are trying to do.
This said, if you do want to do this then you need to put a valid tabular
environment inside the node. In particular, you need to end each row of the environment with \\
. If you do this then your code produces what you want:
Here is the corrected code (which I have also expanded to a full minimal working example):
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzstyle{status}=[draw,rectangle,rounded corners,fill=blue,text centered,inner sep=2pt]
\node[status] (test) {
\begin{tabular}{lcr}
Word 1 & $\rightarrow$ & Value 1\\
Word 2 & $\rightarrow$ & Value 2\\
Word 3 & $\rightarrow$ & Value 3\\
Word 4 & $\rightarrow$ & Value 4
\end{tabular}};
\end{tikzpicture}
\end{document}
Edit
Taking inspiration from Zarko for the arrows, this is how I would probably do this.
\documentclass[svgnames]{article}
\usepackage{tikz}
\usetikzlibrary{fit, arrows.meta, backgrounds}
\begin{document}
\begin{tikzpicture}[
LA/.style={line width=1mm, -{Triangle[angle=90:1pt 2]}, draw=blue!50!gray},
box/.style={rounded corners,fill=blue!30,text centered,inner sep=2pt, draw=MidnightBlue}]
\foreach \word/\val [count=\c] in {Word 1/Value 1,Word 2/Value 2,Word 3/Value 3,Word 4/Value 4} {
\node(word\c) at (0,-0.6*\c) {\word};
\node(val\c) at (2.4,-0.6*\c) {\val};
\draw[LA] (word\c)--(val\c);
}
\begin{scope}[on background layer]
\node[box, fit=(word1) (val4)]{};
\end{scope}
\end{tikzpicture}
\end{document}
to produce:
like this?
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,
matrix}
\begin{document}
\begin{tikzpicture}[
LA/.style = {line width=1mm, -{Triangle[angle=90:1pt 2]}, draw=blue!50!gray},
BL/.style = {baseline=-0.75ex}
]
\node[draw, rounded corners, fill=blue!30,
inner ysep=3mm, inner xsep=2mm,
font=\sffamily\bfseries, align=center,
label={[font=\sffamily\bfseries,anchor=north west]north west:Example text}
]
{\\[2ex]
\renewcommand\arraystretch{1.3}
\begin{tabular}{lcr}
Word 1 & \tikz[BL]\draw[LA] (0,0) -- ++ (1,0); & Value 1 \\
Word 2 & \tikz[BL]\draw[LA] (0,0) -- ++ (1,0); & Value 2 \\
Word 3 & \tikz[BL]\draw[LA] (0,0) -- ++ (1,0); & Value 3 \\
Word 4 & \tikz[BL]\draw[LA] (0,0) -- ++ (1,0); & Value 4 \\
\end{tabular}
};
\end{tikzpicture}
\end{document}