Anis' comment already tells you a lot. Just as add-on, I want to mention few possibilities if you really have content in your nodes and would like to have a homogeneous size. Without knowing your context and needs, mine is just speculation. Hopefully it serves as starting point.
- You could use
text width set to the minimum width (or slightly less) and let TikZ wrap your text (to change alignment, use the align key). This approach prevents the node content, if too long, to exceed the minimum desired width, but it does not prevent the same for the height, though.
- You could then define a style to scale by hand the font, using e.g. the
relsize package. You would use this style to manually reduce the node content when needed. This requires some fine tuning, though.
- You could automatise the previous approach, by getting inspired here. I took one of the answers there in my example below. The idea is to automatically scale the node content to fit a box that in turn fits your node desired size.
As general advice, you might have a look in general to the PGF manual, maybe starting with the minimal introduction to TikZ to get a general overview. Both documents are here.
Here a proof of concept.
\documentclass[border=1mm]{standalone}
\usepackage{tikz,lipsum,environ,relsize}
\usetikzlibrary{positioning}
\newcommand{\fixedWidth}{10cm}
\newcommand{\fixedHeigth}{4cm}
\tikzset{
direct/.style={
rectangle,
minimum height=\fixedHeigth,
minimum width=\fixedWidth,
rounded corners=4.4mm,
fill=red!15,
draw,
thick
},
fontsmaller/.style={font=\smaller[#1]}
}
% Taken from https://tex.stackexchange.com/a/26004/128737
\makeatletter
\NewEnviron{fitbox}[2]{%
\minipage{#1}%
\sbox0{\minipage{#1}\strut\BODY\strut\endminipage}%
\Gscale@div\factor{#2}{\dimexpr\ht0+\dp0\relax}%
\relscale{\factor}%
\BODY
\endminipage
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node [direct] (N1) {Short};
\node [direct, below = of N1] (N2) {
Very long text whose width exceeds the specified minimum
width of the node and hence the desired shape
};
\node [direct, below = of N2, text width=10cm] (N3) {\lipsum[1-2]};
\node [direct, below = of N3, text width=10cm, fontsmaller=3.5] (N4) {\lipsum[1-2]};
\node [direct, below = of N4, text width=10cm] {
\begin{fitbox}{\fixedWidth}{\fixedHeigth}
\lipsum[1-2]
\end{fitbox}
};
\end{tikzpicture}
\end{document}

{}and thus must keep a size that contains that content. If you want a rectangle of exact height and width, you need to draw it as a path aka:\draw (A) rectangle (B)where A and B are nodes or coordinates. – anis Feb 10 '23 at 08:33